chenhaozhe
2025-10-11 7f6fa7d8b4efe045ecb50e9ec22a811255214e5f
修改 生产领料校验,采购入库校验 提交相关 异步请求修改为同步+锁
3个文件已修改
1714 ■■■■■ 已修改文件
pages/caigourukujiaoyan/form.vue 981 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/shengchanlingliao/form.vue 695 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/common.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/caigourukujiaoyan/form.vue
@@ -312,57 +312,113 @@
                })
            },
            //扫描单据号条码
            GetMeesageByBillNo(e) {
                if(this.hform.HBillNo==""||this.hform.HBillNo==undefined){
                    return
                }
                uni.request({
                    url: this.serverUrl + '/WEBSController/get_BillBarCode_BillCheck_Json',
                    data: {
                        HBillNo: this.hform.HBillNo,
                        HBillType: this.hform.HBillType,
                        HMaker: this.hform.HMaker,
                        HStockOrgID: this.hform.HStockOrgID
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
                            CommonUtils.playSound(1);
                            var data = res.data.data
                            console.log('单据信息: ', data)
                            this.hform.HInterID = data.hInterIDField
                            this.hform.HBillNo = data.hBillNoField
                            this.showHBillNo = false
                            //条码核对标记
                            if (data.hSourceBarCodeFlagField) {
                                this.hform.HSourceBarCodeCtl = "Y"
                                this.hform.chkHBarflag = true
                                this.hform.HBarflag = data
                            }
                            this.tabs = 2
                            this.DisBillEntryList();
                            this.refreshHBarCodeFocus()
                        } else {
                            CommonUtils.playSound(0);
                            this.refreshHBillNoFocus()
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                            // this.hform.HBillNo = ''
                        }
                    },
                    fail: (res) => {
                        CommonUtils.playSound(0);
            async GetMeesageByBillNo(e) {
                if (this.hform.HBillNo == "" || this.hform.HBillNo == undefined) {
                    return
                }
                try {
                    let res = await CommonUtils.doRequest2Sync({
                        url: '/WEBSController/get_BillBarCode_BillCheck_Json',
                        data: {
                            HBillNo: this.hform.HBillNo,
                            HBillType: this.hform.HBillType,
                            HMaker: this.hform.HMaker,
                            HStockOrgID: this.hform.HStockOrgID
                        },
                    })
                    if (!res) {
                        // 触发请求锁,不返回任何值
                        return
                    }
                    let {
                        data,
                        Message,
                        count
                    } = res.data
                    if (count == 1) {
                        CommonUtils.playSound(1)
                        console.log(data)
                        this.hform.HInterID = data.hInterIDField
                        this.hform.HBillNo = data.hBillNoField
                        this.showHBillNo = false
                        //条码核对标记
                        if (data.hSourceBarCodeFlagField) {
                            this.hform.HSourceBarCodeCtl = "Y"
                            this.hform.chkHBarflag = true
                            this.hform.HBarflag = data
                        }
                        this.tabs = 2
                        this.DisBillEntryList();
                        this.refreshHBarCodeFocus()
                    } else {
                        CommonUtils.playSound(0)
                        this.refreshHBillNoFocus()
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
                        uni.showToast({
                            title: Message,
                            icon: 'none'
                        })
                        this.hform.HBillNo = ''
                    }
                } catch (e) {
                    CommonUtils.playSound(0)
                    this.refreshHBillNoFocus()
                    uni.showToast({
                        title: '接口请求失败: ' + e,
                        icon: 'none'
                    })
                }
                // uni.request({
                //     url: this.serverUrl + '/WEBSController/get_BillBarCode_BillCheck_Json',
                //     data: {
                //         HBillNo: this.hform.HBillNo,
                //         HBillType: this.hform.HBillType,
                //         HMaker: this.hform.HMaker,
                //         HStockOrgID: this.hform.HStockOrgID
                //     },
                //     success: (res) => {
                //         if (res.data.count == 1) {
                //             CommonUtils.playSound(1);
                //             var data = res.data.data
                //             console.log('单据信息: ', data)
                //             this.hform.HInterID = data.hInterIDField
                //             this.hform.HBillNo = data.hBillNoField
                //             this.showHBillNo = false
                //             //条码核对标记
                //             if (data.hSourceBarCodeFlagField) {
                //                 this.hform.HSourceBarCodeCtl = "Y"
                //                 this.hform.chkHBarflag = true
                //                 this.hform.HBarflag = data
                //             }
                //             this.tabs = 2
                //             this.DisBillEntryList();
                //             this.refreshHBarCodeFocus()
                //         } else {
                //             CommonUtils.playSound(0);
                //             this.refreshHBillNoFocus()
                //             uni.showToast({
                //                 title: res.data.Message,
                //                 icon: 'none'
                //             })
                //
                //             // this.hform.HBillNo = ''
                //         }
                //     },
                //     fail: (res) => {
                //         CommonUtils.playSound(0);
                //         this.refreshHBillNoFocus()
                //         console.log(res);
                //         uni.showToast({
                //             title: '接口请求失败',
                //             icon: 'none'
                //         })
                //     },
                // });
            },
            //基础仓库资料
            getHBaseList() {
                uni.request({
@@ -449,202 +505,377 @@
                    }
                }
            },
            getCode(HBarCode) {
                console.log(HBarCode);
                if(HBarCode==undefined||HBarCode==""){
                    return
                }
                //仓库、仓位文本框为空时,清空对应ID
                if (!this.hform.HWHName) {
                    this.hform.HWHID = 0
                }
                if (!this.hform.HStockPlaceName) {
                    this.hform.HStockPlaceID = 0
                }
                var sOldBarCode = HBarCode
                var HDeleteFlag = sOldBarCode.substring(0, 1);
                var sBarCode = sOldBarCode.slice(1);
                var sHWHID = this.hform.HWHID
                var sHSPID = this.hform.HStockPlaceID
                var sHQty = this.hform.HQty
                var sSourceBillNo = this.hform.HSourceBillNo
                var sSourceBillType = this.hform.HMainSourceBillType
                var HSourceFlag = this.hform.HSourceBillNo == '' ? false : true
                console.log(this.hform.HSourceBillNo, HSourceFlag)
                if (HDeleteFlag == "*") {
                    if (sBarCode == "") {
                        uni.showToast({
                            title: '请输入要删除的条码',
                            icon: 'none'
                        })
                    } else {
                        uni.request({
                            url: this.serverUrl + '/WEBSController/set_DelPonderationBillMain_Temp_BarCode_Json',
                            data: {
                                HInterID: this.hform.HInterID,
                                HBillType: this.hform.HBillType,
                                HBarCode: sBarCode
                            },
                            success: (res) => {
                                console.log('删除条码', res.data);
                                this.hform.HBarCode = ''
                                if (res.data.count == 1) {
                                    this.hform.HQty = ''
                                    this.DisBillEntryList()
                                } else {
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                                uni.showToast({
                                    title: '接口请求失败',
                                    icon: 'none'
                                })
                            },
                        });
                    }
                } else {
                    var sBarCode = this.hform.HBarCode
                    if (sHQty == "") {
                        sHQty = 0;
                    }
                    console.log("单据信息: ", this.hform)
                    uni.request({
                        url: this.serverUrl + '/WEBSController/get_CheckTypeByBarCode_BillCheck_Json',
                        data: {
                            sBarCode: sBarCode,
                            HBillID: this.hform.HInterID || 0,
                            HBillType: this.hform.HBillType,
                            HBillNo: this.hform.HBillNo,
                            HMaker: this.hform.HMaker,
                            HWhID: sHWHID,
                            HSPID: sHSPID,
                            HQty: sHQty,
                            // HRedBlueFlag: this.hform.HRedBlueFlag,
                            // SourceFlag: HSourceFlag,
                            // HSourceBillNo: sSourceBillNo,
                            // HSourceBillType: sSourceBillType,
                            HStockOrgID: this.hform.HStockOrgID,
                            // HScanStyle: "",
                            // HCustom1: "",
                            // HCustom2: ""
                        },
                        success: (res) => {
                            console.log('扫码返回', res.data);
                            // this.hform.HBarCode = ''
                            if (res.data.count == 1) {
                                CommonUtils.playSound(1);
                                var data = res.data.data
                                if (data.hBarTypeField == '仓库条码') {
                                    this.hform.HWHName = data.hWhNameField
                                    this.hform.HWHID = data.hWhIDField
                                    this.hform.HStockPlaceName = ''
                                    this.hform.HStockPlaceID = 0
                                    // if (data.hSPFlagField == 0) {
                                    //     this.showHStockPlaceName = false
                                    // } else {
                                    //     this.showHStockPlaceName = true
                                    // }
                                } else if (data.hBarTypeField == '仓位条码') {
                                    this.hform.HWHName = data.hWhNameField
                                    this.hform.HWHID = data.hWhIDField
                                    this.hform.HStockPlaceName = data.hSPNameField
                                    this.hform.HStockPlaceID = data.hSPIDField
                                } else if (data.hBarTypeField == '部门条码') {
                                    this.hform.HDeptName = data.hDeptNameField
                                    this.hform.HDeptID = data.hDeptIDField
                                    this.tabs = 1
                                } else if (data.hBarTypeField == '源单条码') {
                                    this.hform.HSupName = data.hSupNameField
                                    this.hform.HSupID = data.hSupIDField
                                    if (data.hDeptIDField != 0) {
                                        this.hform.HDeptID = data.hDeptIDField
                                        this.hform.HDeptName = data.hDeptNameField
                                    }
                                    this.hform.HSourceBillNo = data.hSourceBillNoField
                                    //获取源单类型、源单单号
                                    if (data.hSourceBillTypeField == "1103") {
                                        this.HMainSourceBillType = '收料通知单'
                                        this.hform.HMainSourceBillType = 1103
                                        this.showHMainSourceBillType = false
                                    } else if (data.hSourceBillTypeField == "1102") {
                                        this.HMainSourceBillType = '采购订单'
                                        this.hform.HMainSourceBillType = 1102
                                        this.showHMainSourceBillType = false
                                    } else {
                                        this.HMainSourceBillType = '手工录入'
                                        this.hform.HMainSourceBillType = -1
                                        this.showHMainSourceBillType = false
                                    }
                                    if (data.hMulSourceFlagField == 0) {
                                        this.showHSourceBillNo = false
                                    }
                                    //供应商不可编辑
                                    this.showHSupName = false
                                    this.tabs = 2
                                } else { //物料条码
                                    this.tabs = 2
                                    if (!this.hform.HSourceBillNo) {
                                        this.hform.HSupName = data.hSupNameField
                                        this.hform.HSupID = data.hSupIDField
                                        this.hform.HSourceBillNo = data.hSourceBillNoField
                                        if (data.hDeptIDField != 0) {
                                            this.hform.HDeptID = data.hDeptIDField
                                            this.hform.HDeptName = data.hDeptNameField
                                        }
                                        console.log(data)
                                        //获取源单类型、源单单号
                                        this.hform.HMainSourceBillType = data.hSourceBillTypeField
                                        if (data.hSourceBillTypeField == "1103") {
                                            this.HMainSourceBillType = '收料通知单'
                                            this.hform.HMainSourceBillType = 1103
                                            this.showHMainSourceBillType = false
                                        } else if (data.hSourceBillTypeField == "1102") {
                                            this.HMainSourceBillType = '采购订单'
                                            this.hform.HMainSourceBillType = 1102
                                            this.showHMainSourceBillType = false
                                        } else {
                                            this.HMainSourceBillType = '手工录入'
                                            this.hform.HMainSourceBillType = -1
                                            this.showHMainSourceBillType = false
                                        }
                                        if (data.hMulSourceFlagField == 0) {
                                            this.showHSourceBillNo = false
                                        }
                                        //供应商不可编辑
                                        this.showHSupName = false
                                    }
                                }
                                //显示表体明细
                                this.DisBillEntryList()
                                //清空数量
                                this.hform.HQty = ''
                            } else {
                                CommonUtils.playSound(0);
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            }
                            this.refreshHBarCodeFocus()
                        },
                        fail: (res) => {
                            CommonUtils.playSound(0);
                            console.log(res);
                            this.refreshHBarCodeFocus()
                            uni.showToast({
                                title: '接口请求失败',
                                icon: 'none'
                            })
                        },
                    });
                }
            //扫条码处理
            async getCode(HBarCode) {
                if (HBarCode == undefined || HBarCode == "") {
                    return
                }
                //仓库、仓位文本框为空时,清空对应ID
                if (!this.hform.HWHName) {
                    this.hform.HWHID = 0
                }
                if (!this.hform.HStockPlaceName) {
                    this.hform.HStockPlaceID = 0
                }
                var sOldBarCode = HBarCode
                var HDeleteFlag = sOldBarCode.substring(0, 1);
                var sBarCode = sOldBarCode.slice(1);
                var sHWHID = this.hform.HWHID
                var sHSPID = this.hform.HStockPlaceID
                var sHQty = this.hform.HQty
                var sSourceBillNo = this.hform.HSourceBillNo
                var sSourceBillType = this.hform.HMainSourceBillType
                var HSourceFlag = this.hform.HSourceBillNo == '' ? false : true
                console.log(this.hform.HSourceBillNo, HSourceFlag)
                if (HDeleteFlag == "*") {
                    if (sBarCode == "") {
                        uni.showToast({
                            title: '请输入要删除的条码',
                            icon: 'none'
                        })
                    } else {
                        try {
                            let res = await CommonUtils.doRequest2Sync({
                                url: '/WEBSController/set_DelPonderationBillMain_Temp_BarCode_Json',
                                data: {
                                    HInterID: this.hform.HInterID,
                                    HBillType: this.hform.HBillType,
                                    HBarCode: sBarCode
                                },
                            })
                            if (!res) {
                                // 请求被锁定,退出当前请求
                                return
                            }
                            console.log('删除条码', res.data);
                            this.hform.HBarCode = ''
                            if (res.data.count == 1) {
                                this.hform.HQty = ''
                                this.DisBillEntryList()
                            } else {
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            }
                        } catch (e) {
                            CommonUtils.playSound(0)
                            this.refreshHBillNoFocus()
                            uni.showToast({
                                title: '接口请求失败: ' + e,
                                icon: 'none'
                            })
                        }
                        // uni.request({
                        //     url: this.serverUrl +
                        //         '/WEBSController/set_DelPonderationBillMain_Temp_BarCode_Json',
                        //     data: {
                        //         HInterID: this.hform.HInterID,
                        //         HBillType: this.hform.HBillType,
                        //         HBarCode: sBarCode
                        //     },
                        //     success: (res) => {
                        //         console.log('删除条码', res.data);
                        //         this.hform.HBarCode = ''
                        //         if (res.data.count == 1) {
                        //             this.hform.HQty = ''
                        //             this.DisBillEntryList()
                        //         } else {
                        //             uni.showToast({
                        //                 title: res.data.Message,
                        //                 icon: 'none'
                        //             })
                        //         }
                        //     },
                        //     fail: (res) => {
                        //         console.log(res);
                        //         uni.showToast({
                        //             title: '接口请求失败',
                        //             icon: 'none'
                        //         })
                        //     },
                        // });
                    }
                } else {
                    var sBarCode = this.hform.HBarCode
                    if (sHQty == "") {
                        sHQty = 0;
                    }
                    try {
                        let res = await CommonUtils.doRequest2Sync({
                            url: '/WEBSController/get_CheckTypeByBarCode_BillCheck_Json',
                            data: {
                                sBarCode: sBarCode,
                                HBillID: this.hform.HInterID || 0,
                                HBillType: this.hform.HBillType,
                                HBillNo: this.hform.HBillNo,
                                HMaker: this.hform.HMaker,
                                HWhID: sHWHID,
                                HSPID: sHSPID,
                                HQty: sHQty,
                                // HRedBlueFlag: this.hform.HRedBlueFlag,
                                // SourceFlag: HSourceFlag,
                                // HSourceBillNo: sSourceBillNo,
                                // HSourceBillType: sSourceBillType,
                                HStockOrgID: this.hform.HStockOrgID,
                                // HScanStyle: "",
                                // HCustom1: "",
                                // HCustom2: ""
                            },
                        })
                        if (!res) {
                            return
                        }
                        console.log('扫码返回', res.data);
                        this.hform.HBarCode = ''
                        if (res.data.count == 1) {
                            CommonUtils.playSound(1);
                            var data = res.data.data
                            if (data.hBarTypeField == '仓库条码') {
                                this.hform.HWHName = data.hWhNameField
                                this.hform.HWHID = data.hWhIDField
                                this.hform.HStockPlaceName = ''
                                this.hform.HStockPlaceID = 0
                                if (data.hSPFlagField == 0) {
                                    this.showHStockPlaceName = false
                                } else {
                                    this.showHStockPlaceName = true
                                }
                            } else if (data.hBarTypeField == '仓位条码') {
                                this.hform.HWHName = data.hWhNameField
                                this.hform.HWHID = data.hWhIDField
                                this.hform.HStockPlaceName = data.hSPNameField
                                this.hform.HStockPlaceID = data.hSPIDField
                            } else if (data.hBarTypeField == '部门条码') {
                                this.hform.HDeptName = data.hDeptNameField
                                this.hform.HDeptID = data.hDeptIDField
                                this.tabs = 1
                            } else if (data.hBarTypeField == '源单条码') {
                                this.hform.HSupName = data.hSupNameField
                                this.hform.HSupID = data.hSupIDField
                                if (data.hDeptIDField != 0) {
                                    this.hform.HDeptID = data.hDeptIDField
                                    this.hform.HDeptName = data.hDeptNameField
                                }
                                this.hform.HSourceBillNo = data.hSourceBillNoField
                                //获取源单类型、源单单号
                                if (data.hSourceBillTypeField == "1103") {
                                    this.HMainSourceBillType = '收料通知单'
                                    this.hform.HMainSourceBillType = 1103
                                    this.showHMainSourceBillType = false
                                } else if (data.hSourceBillTypeField == "1102") {
                                    this.HMainSourceBillType = '采购订单'
                                    this.hform.HMainSourceBillType = 1102
                                    this.showHMainSourceBillType = false
                                } else {
                                    this.HMainSourceBillType = '手工录入'
                                    this.hform.HMainSourceBillType = -1
                                    this.showHMainSourceBillType = false
                                }
                                if (data.hMulSourceFlagField == 0) {
                                    this.showHSourceBillNo = false
                                }
                                //供应商不可编辑
                                this.showHSupName = false
                                this.tabs = 2
                            } else { //物料条码
                                this.tabs = 2
                                console.log('data', data)
                                if (!this.hform.HSourceBillNo) {
                                    this.hform.HSupName = data.hSupNameField
                                    this.hform.HSupID = data.hSupIDField
                                    this.hform.HSourceBillNo = data.hSourceBillNoField
                                    if (data.hDeptIDField != 0) {
                                        this.hform.HDeptID = data.hDeptIDField
                                        this.hform.HDeptName = data.hDeptNameField
                                    }
                                    //获取源单类型、源单单号
                                    this.hform.HMainSourceBillType = data.hSourceBillTypeField
                                    if (data.hSourceBillTypeField == "1103") {
                                        this.HMainSourceBillType = '收料通知单'
                                        this.hform.HMainSourceBillType = 1103
                                        this.showHMainSourceBillType = false
                                    } else if (data.hSourceBillTypeField == "1102") {
                                        this.HMainSourceBillType = '采购订单'
                                        this.hform.HMainSourceBillType = 1102
                                        this.showHMainSourceBillType = false
                                    } else {
                                        this.HMainSourceBillType = '手工录入'
                                        this.hform.HMainSourceBillType = -1
                                        this.showHMainSourceBillType = false
                                    }
                                    if (data.hMulSourceFlagField == 0) {
                                        this.showHSourceBillNo = false
                                    }
                                    //供应商不可编辑
                                    this.showHSupName = false
                                }
                            }
                            //显示表体明细
                            this.DisBillEntryList()
                            //清空数量
                            this.hform.HQty = ''
                        } else {
                            CommonUtils.playSound(0);
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                        this.refreshHBarCodeFocus()
                    } catch (e) {
                        CommonUtils.playSound(0)
                        this.refreshHBillNoFocus()
                        uni.showToast({
                            title: '接口请求失败: ' + e,
                            icon: 'none'
                        })
                    }
                    // uni.request({
                    //     url: this.serverUrl + '/WEBSController/get_CheckTypeByBarCode_BillCheck_Json',
                    //     data: {
                    //         sBarCode: sBarCode,
                    //         HBillID: this.hform.HInterID || 0,
                    //         HBillType: this.hform.HBillType,
                    //         HBillNo: this.hform.HBillNo,
                    //         HMaker: this.hform.HMaker,
                    //         HWhID: sHWHID,
                    //         HSPID: sHSPID,
                    //         HQty: sHQty,
                    //         // HRedBlueFlag: this.hform.HRedBlueFlag,
                    //         // SourceFlag: HSourceFlag,
                    //         // HSourceBillNo: sSourceBillNo,
                    //         // HSourceBillType: sSourceBillType,
                    //         HStockOrgID: this.hform.HStockOrgID,
                    //         // HScanStyle: "",
                    //         // HCustom1: "",
                    //         // HCustom2: ""
                    //     },
                    //     success: (res) => {
                    //         console.log('扫码返回', res.data);
                    //         this.hform.HBarCode = ''
                    //         if (res.data.count == 1) {
                    //             CommonUtils.playSound(1);
                    //             var data = res.data.data
                    //             if (data.hBarTypeField == '仓库条码') {
                    //                 this.hform.HWHName = data.hWhNameField
                    //                 this.hform.HWHID = data.hWhIDField
                    //                 this.hform.HStockPlaceName = ''
                    //                 this.hform.HStockPlaceID = 0
                    //                 if (data.hSPFlagField == 0) {
                    //                     this.showHStockPlaceName = false
                    //                 } else {
                    //                     this.showHStockPlaceName = true
                    //                 }
                    //             } else if (data.hBarTypeField == '仓位条码') {
                    //                 this.hform.HWHName = data.hWhNameField
                    //                 this.hform.HWHID = data.hWhIDField
                    //                 this.hform.HStockPlaceName = data.hSPNameField
                    //                 this.hform.HStockPlaceID = data.hSPIDField
                    //             } else if (data.hBarTypeField == '部门条码') {
                    //                 this.hform.HDeptName = data.hDeptNameField
                    //                 this.hform.HDeptID = data.hDeptIDField
                    //                 this.tabs = 1
                    //             } else if (data.hBarTypeField == '源单条码') {
                    //                 this.hform.HSupName = data.hSupNameField
                    //                 this.hform.HSupID = data.hSupIDField
                    //                 if (data.hDeptIDField != 0) {
                    //                     this.hform.HDeptID = data.hDeptIDField
                    //                     this.hform.HDeptName = data.hDeptNameField
                    //                 }
                    //                 this.hform.HSourceBillNo = data.hSourceBillNoField
                    //                 //获取源单类型、源单单号
                    //                 if (data.hSourceBillTypeField == "1103") {
                    //                     this.HMainSourceBillType = '收料通知单'
                    //                     this.hform.HMainSourceBillType = 1103
                    //                     this.showHMainSourceBillType = false
                    //                 } else if (data.hSourceBillTypeField == "1102") {
                    //                     this.HMainSourceBillType = '采购订单'
                    //                     this.hform.HMainSourceBillType = 1102
                    //                     this.showHMainSourceBillType = false
                    //                 } else {
                    //                     this.HMainSourceBillType = '手工录入'
                    //                     this.hform.HMainSourceBillType = -1
                    //                     this.showHMainSourceBillType = false
                    //                 }
                    //                 if (data.hMulSourceFlagField == 0) {
                    //                     this.showHSourceBillNo = false
                    //                 }
                    //                 //供应商不可编辑
                    //                 this.showHSupName = false
                    //                 this.tabs = 2
                    //             } else { //物料条码
                    //                 this.tabs = 2
                    //                 console.log('data', data)
                    //                 if (!this.hform.HSourceBillNo) {
                    //                     this.hform.HSupName = data.hSupNameField
                    //                     this.hform.HSupID = data.hSupIDField
                    //                     this.hform.HSourceBillNo = data.hSourceBillNoField
                    //                     if (data.hDeptIDField != 0) {
                    //                         this.hform.HDeptID = data.hDeptIDField
                    //                         this.hform.HDeptName = data.hDeptNameField
                    //                     }
                    //                     //获取源单类型、源单单号
                    //                     this.hform.HMainSourceBillType = data.hSourceBillTypeField
                    //                     if (data.hSourceBillTypeField == "1103") {
                    //                         this.HMainSourceBillType = '收料通知单'
                    //                         this.hform.HMainSourceBillType = 1103
                    //                         this.showHMainSourceBillType = false
                    //                     } else if (data.hSourceBillTypeField == "1102") {
                    //                         this.HMainSourceBillType = '采购订单'
                    //                         this.hform.HMainSourceBillType = 1102
                    //                         this.showHMainSourceBillType = false
                    //                     } else {
                    //                         this.HMainSourceBillType = '手工录入'
                    //                         this.hform.HMainSourceBillType = -1
                    //                         this.showHMainSourceBillType = false
                    //                     }
                    //                     if (data.hMulSourceFlagField == 0) {
                    //                         this.showHSourceBillNo = false
                    //                     }
                    //                     //供应商不可编辑
                    //                     this.showHSupName = false
                    //                 }
                    //             }
                    //             //显示表体明细
                    //             this.DisBillEntryList()
                    //             //清空数量
                    //             this.hform.HQty = ''
                    //         } else {
                    //             CommonUtils.playSound(0);
                    //             uni.showToast({
                    //                 title: res.data.Message,
                    //                 icon: 'none'
                    //             })
                    //         }
                    //
                    //         this.refreshHBarCodeFocus()
                    //     },
                    //     fail: (res) => {
                    //         CommonUtils.playSound(0);
                    //         console.log(res);
                    //         uni.showToast({
                    //             title: '接口请求失败',
                    //             icon: 'none'
                    //         })
                    //
                    //         this.refreshHBarCodeFocus()
                    //     },
                    // });
                }
            },
            //物料信息
            DisBillEntryList() {
@@ -736,91 +967,179 @@
                    }
                });
            },
            submit() {
                if (this.hform.HInterID == 0 || !this.hform.HInterID) {
                    uni.showToast({
                        title: '没有扫码信息,请先扫描单据条码!',
                        icon: 'none'
                    })
                } else if (!this.hform.HBillNo) {
                    uni.showToast({
                        title: '单据号获取失败,错误的单据号!',
                        icon: 'none'
                    })
                } else if (!this.Materlist || this.Materlist.length == 0) {
                    uni.showToast({
                        title: '没有扫码信息,请先扫描条码,确认无误后再提交!',
                        icon: 'none'
                    })
                } else {
                    var s = 0;
                    for (var i = 0; i < this.Materlist.length; i++) {
                        if (this.Materlist[i].数量 > 0) {
                            s = 1;
                        }
                    }
                    if (s == 0) {
                        uni.showToast({
                            title: '没有扫描物料条码,请先扫描物料条码,确认无误后再提交!',
                            icon: 'none'
                        })
                    } else {
                        uni.showLoading({
                            title: '请稍候'
                        })
                        var sMainStr = JSON.stringify(this.hform);
                        uni.request({
                            url: this.serverUrl + '/WEBSController/set_SavePOStockInBill_BillCheck_Json',
                            method: 'POST',
                            dataType: "json",
                            data: {
                                oMain: sMainStr
                            },
                            success: (res) => {
                                console.log(1, res);
                                uni.hideLoading()
                                if (res.data.count == 1) {
                                    uni.showModal({
                                        title: '提示',
                                        content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                                        success: (res) => {
                                            if (res.confirm) {
                                                console.log('用户点击确定');
                                                uni.redirectTo({
                                                    url: '/pages/caigourukujiaoyan/form?OperationType=1'
                                                })
                                            } else if (res.cancel) {
                                                console.log('用户点击取消');
                                                setTimeout(() => {
                                                    uni.navigateBack();
                                                }, 50)
                                            }
                                        }
                                    });
                                } else {
                                    // uni.showToast({
                                    //     title: res.data.Message,
                                    //     icon: 'none'
                                    // })
                                    uni.showModal({
                                        title: '温馨提示',
                                        content: res.data.Message,
                                        showCancel: false
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                                uni.showToast({
                                    title: '接口请求失败',
                                    icon: 'none'
                                })
                            },
                        });
                    }
                }
            },
            async submit() {
                if (this.hform.HInterID == 0 || !this.hform.HInterID) {
                    uni.showToast({
                        title: '没有扫码信息,请先扫描单据条码!',
                        icon: 'none'
                    })
                } else if (!this.hform.HBillNo) {
                    uni.showToast({
                        title: '单据号获取失败,错误的单据号!',
                        icon: 'none'
                    })
                } else if (!this.Materlist || this.Materlist.length == 0) {
                    uni.showToast({
                        title: '没有扫码信息,请先扫描条码,确认无误后再提交!',
                        icon: 'none'
                    })
                } else {
                    var s = 0;
                    for (var i = 0; i < this.Materlist.length; i++) {
                        if (this.Materlist[i].数量 > 0) {
                            s = 1;
                        }
                    }
                    // if (s == 0) {
                    //     uni.showToast({
                    //         title: '没有扫描物料条码,请先扫描物料条码,确认无误后再提交!',
                    //         icon: 'none'
                    //     })
                    // } else
                    {
                        uni.showLoading({
                            title: '请稍候'
                        })
                        var sMainStr = JSON.stringify(this.hform);
                        try {
                            let res = await CommonUtils.doRequest2Sync({
                                url: '/WEBSController/set_SavePOStockInBill_BillCheck_Json',
                                method: 'POST',
                                data: {
                                    oMain: sMainStr
                                },
                            })
                            if(!res) {
                                return
                            }
                            console.log(1, res);
                            uni.hideLoading()
                            if (res.data.count == 1) {
                                uni.showModal({
                                    title: '提示',
                                    content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                                    success: (res) => {
                                        if (res.confirm) {
                                            console.log('用户点击确定');
                                            uni.redirectTo({
                                                url: '/pages/caigourukujiaoyan/form?OperationType=1'
                                            })
                                        } else if (res.cancel) {
                                            console.log('用户点击取消');
                                            setTimeout(() => {
                                                uni.navigateBack();
                                            }, 50)
                                        }
                                    }
                                });
                            } else {
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            }
                        } catch (e) {
                            CommonUtils.playSound(0)
                            this.refreshHBillNoFocus()
                            uni.showToast({
                                title: '接口请求失败: ' + e,
                                icon: 'none'
                            })
                        }
                    }
                }
            },
            // submit() {
            //     if (this.hform.HInterID == 0 || !this.hform.HInterID) {
            //         uni.showToast({
            //             title: '没有扫码信息,请先扫描单据条码!',
            //             icon: 'none'
            //         })
            //     } else if (!this.hform.HBillNo) {
            //         uni.showToast({
            //             title: '单据号获取失败,错误的单据号!',
            //             icon: 'none'
            //         })
            //     } else if (!this.Materlist || this.Materlist.length == 0) {
            //         uni.showToast({
            //             title: '没有扫码信息,请先扫描条码,确认无误后再提交!',
            //             icon: 'none'
            //         })
            //     } else {
            //         var s = 0;
            //         for (var i = 0; i < this.Materlist.length; i++) {
            //             if (this.Materlist[i].数量 > 0) {
            //                 s = 1;
            //             }
            //         }
            //         if (s == 0) {
            //             uni.showToast({
            //                 title: '没有扫描物料条码,请先扫描物料条码,确认无误后再提交!',
            //                 icon: 'none'
            //             })
            //         } else {
            //             uni.showLoading({
            //                 title: '请稍候'
            //             })
            //             var sMainStr = JSON.stringify(this.hform);
            //             uni.request({
            //                 url: this.serverUrl + '/WEBSController/set_SavePOStockInBill_BillCheck_Json',
            //                 method: 'POST',
            //                 dataType: "json",
            //                 data: {
            //                     oMain: sMainStr
            //                 },
            //                 success: (res) => {
            //                     console.log(1, res);
            //                     uni.hideLoading()
            //                     if (res.data.count == 1) {
            //                         uni.showModal({
            //                             title: '提示',
            //                             content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
            //                             success: (res) => {
            //                                 if (res.confirm) {
            //                                     console.log('用户点击确定');
            //                                     uni.redirectTo({
            //                                         url: '/pages/caigourukujiaoyan/form?OperationType=1'
            //                                     })
            //                                 } else if (res.cancel) {
            //                                     console.log('用户点击取消');
            //                                     setTimeout(() => {
            //                                         uni.navigateBack();
            //                                     }, 50)
            //                                 }
            //                             }
            //                         });
            //                     } else {
            //                         // uni.showToast({
            //                         //     title: res.data.Message,
            //                         //     icon: 'none'
            //                         // })
            //
            //                         uni.showModal({
            //                             title: '温馨提示',
            //                             content: res.data.Message,
            //                             showCancel: false
            //                         })
            //                     }
            //                 },
            //                 fail: (res) => {
            //                     console.log(res);
            //                     uni.showToast({
            //                         title: '接口请求失败',
            //                         icon: 'none'
            //                     })
            //                 },
            //             });
            //         }
            //     }
            // },
            goBack() {
                uni.showModal({
pages/shengchanlingliao/form.vue
@@ -5,7 +5,7 @@
                <view class="title">条码:</view>
                <view class="right" style="width: 380rpx;">
                    <input v-model="hform.HBarCode" :focus="HBarCodeFocus" placeholder="请扫描(或输入)条码"
                         @blur="getCode(hform.HBarCode)" />
                        @blur="getCode(hform.HBarCode)" />
                </view>
                <uni-icons type="scan"
                    style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
@@ -46,7 +46,7 @@
                    <view class="title">单据号:</view>
                    <view class="right" style="width: 380rpx;">
                        <input name="HBillNo" :focus="HBillNoFocus" v-model="hform.HBillNo" placeholder="请扫描(或输入)条码"
                             @blur="GetMeesageByBillNo()" />
                            @blur="GetMeesageByBillNo()" />
                    </view>
                    <uni-icons type="scan"
                        style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
@@ -393,55 +393,110 @@
                })
            },
            //扫描单据号条码
            GetMeesageByBillNo(e) {
            async GetMeesageByBillNo(e) {
                if (this.hform.HBillNo == "" || this.hform.HBillNo == undefined) {
                    return
                }
                uni.request({
                    url: this.serverUrl + '/WEBSController/get_BillBarCode_BillCheck_Json',
                    data: {
                        HBillNo: this.hform.HBillNo,
                        HBillType: this.hform.HBillType,
                        HMaker: this.hform.HMaker,
                        HStockOrgID: this.hform.HStockOrgID
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
                            this.playSound(1)
                            var data = res.data.data
                            console.log(data)
                            this.hform.HInterID = data.hInterIDField
                            this.hform.HBillNo = data.hBillNoField
                            this.showHBillNo = false
                            //条码核对标记
                            if (data.hSourceBarCodeFlagField) {
                                this.hform.HSourceBarCodeCtl = "Y"
                                this.hform.chkHBarflag = true
                                this.hform.HBarflag = data
                            }
                            this.tabs = 2
                            this.DisBillEntryList();
                            this.refreshHBarCodeFocus()
                        } else {
                            this.playSound(0)
                            this.refreshHBillNoFocus()
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                            this.hform.HBillNo = ''
                try {
                    let res = await CommonUtils.doRequest2Sync({
                        url: '/WEBSController/get_BillBarCode_BillCheck_Json',
                        data: {
                            HBillNo: this.hform.HBillNo,
                            HBillType: this.hform.HBillType,
                            HMaker: this.hform.HMaker,
                            HStockOrgID: this.hform.HStockOrgID
                        },
                    })
                    if (!res) {
                        // 触发请求锁,不返回任何值
                        return
                    }
                    let {
                        data,
                        Message,
                        count
                    } = res.data
                    if (count == 1) {
                        this.playSound(1)
                        console.log(data)
                        this.hform.HInterID = data.hInterIDField
                        this.hform.HBillNo = data.hBillNoField
                        this.showHBillNo = false
                        //条码核对标记
                        if (data.hSourceBarCodeFlagField) {
                            this.hform.HSourceBarCodeCtl = "Y"
                            this.hform.chkHBarflag = true
                            this.hform.HBarflag = data
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        this.tabs = 2
                        this.DisBillEntryList();
                        this.refreshHBarCodeFocus()
                    } else {
                        this.playSound(0)
                        this.refreshHBillNoFocus()
                        uni.showToast({
                            title: '接口请求失败',
                            title: Message,
                            icon: 'none'
                        })
                    },
                });
                        this.hform.HBillNo = ''
                    }
                } catch (e) {
                    this.playSound(0)
                    this.refreshHBillNoFocus()
                    uni.showToast({
                        title: '接口请求失败: ' + e,
                        icon: 'none'
                    })
                }
                // uni.request({
                //     url: this.serverUrl + '/WEBSController/get_BillBarCode_BillCheck_Json',
                //     data: {
                //         HBillNo: this.hform.HBillNo,
                //         HBillType: this.hform.HBillType,
                //         HMaker: this.hform.HMaker,
                //         HStockOrgID: this.hform.HStockOrgID
                //     },
                //     success: (res) => {
                //         if (res.data.count == 1) {
                //             this.playSound(1)
                //             var data = res.data.data
                //             console.log(data)
                //             this.hform.HInterID = data.hInterIDField
                //             this.hform.HBillNo = data.hBillNoField
                //             this.showHBillNo = false
                //             //条码核对标记
                //             if (data.hSourceBarCodeFlagField) {
                //                 this.hform.HSourceBarCodeCtl = "Y"
                //                 this.hform.chkHBarflag = true
                //                 this.hform.HBarflag = data
                //             }
                //             this.tabs = 2
                //             this.DisBillEntryList();
                //             this.refreshHBarCodeFocus()
                //         } else {
                //             this.playSound(0)
                //             this.refreshHBillNoFocus()
                //             uni.showToast({
                //                 title: res.data.Message,
                //                 icon: 'none'
                //             })
                //             this.hform.HBillNo = ''
                //         }
                //     },
                //     fail: (res) => {
                //         console.log(res);
                //         this.playSound(0)
                //         this.refreshHBillNoFocus()
                //         uni.showToast({
                //             title: '接口请求失败',
                //             icon: 'none'
                //         })
                //     },
                // });
            },
            //基础仓库资料
            getHBaseList() {
@@ -528,7 +583,7 @@
                }
            },
            //扫条码处理
            getCode(HBarCode) {
            async getCode(HBarCode) {
                if (HBarCode == undefined || HBarCode == "") {
                    return
                }
@@ -557,95 +612,172 @@
                            icon: 'none'
                        })
                    } else {
                        uni.request({
                            url: this.serverUrl +
                                '/WEBSController/set_DelPonderationBillMain_Temp_BarCode_Json',
                            data: {
                                HInterID: this.hform.HInterID,
                                HBillType: this.hform.HBillType,
                                HBarCode: sBarCode
                            },
                            success: (res) => {
                                console.log('删除条码', res.data);
                                this.hform.HBarCode = ''
                                if (res.data.count == 1) {
                                    this.hform.HQty = ''
                                    this.DisBillEntryList()
                                } else {
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                        try {
                            let res = await CommonUtils.doRequest2Sync({
                                url: '/WEBSController/set_DelPonderationBillMain_Temp_BarCode_Json',
                                data: {
                                    HInterID: this.hform.HInterID,
                                    HBillType: this.hform.HBillType,
                                    HBarCode: sBarCode
                                },
                            })
                            if (!res) {
                                // 请求被锁定,退出当前请求
                                return
                            }
                            console.log('删除条码', res.data);
                            this.hform.HBarCode = ''
                            if (res.data.count == 1) {
                                this.hform.HQty = ''
                                this.DisBillEntryList()
                            } else {
                                uni.showToast({
                                    title: '接口请求失败',
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            },
                        });
                            }
                        } catch (e) {
                            this.playSound(0)
                            this.refreshHBillNoFocus()
                            uni.showToast({
                                title: '接口请求失败: ' + e,
                                icon: 'none'
                            })
                        }
                        // uni.request({
                        //     url: this.serverUrl +
                        //         '/WEBSController/set_DelPonderationBillMain_Temp_BarCode_Json',
                        //     data: {
                        //         HInterID: this.hform.HInterID,
                        //         HBillType: this.hform.HBillType,
                        //         HBarCode: sBarCode
                        //     },
                        //     success: (res) => {
                        //         console.log('删除条码', res.data);
                        //         this.hform.HBarCode = ''
                        //         if (res.data.count == 1) {
                        //             this.hform.HQty = ''
                        //             this.DisBillEntryList()
                        //         } else {
                        //             uni.showToast({
                        //                 title: res.data.Message,
                        //                 icon: 'none'
                        //             })
                        //         }
                        //     },
                        //     fail: (res) => {
                        //         console.log(res);
                        //         uni.showToast({
                        //             title: '接口请求失败',
                        //             icon: 'none'
                        //         })
                        //     },
                        // });
                    }
                } else {
                    var sBarCode = this.hform.HBarCode
                    if (sHQty == "") {
                        sHQty = 0;
                    }
                    uni.request({
                        url: this.serverUrl + '/WEBSController/get_CheckTypeByBarCode_BillCheck_Json',
                        data: {
                            sBarCode: sBarCode,
                            HBillID: this.hform.HInterID || 0,
                            HBillType: this.hform.HBillType,
                            HBillNo: this.hform.HBillNo,
                            HMaker: this.hform.HMaker,
                            HWhID: sHWHID,
                            HSPID: sHSPID,
                            HQty: sHQty,
                            // HRedBlueFlag: this.hform.HRedBlueFlag,
                            // SourceFlag: HSourceFlag,
                            // HSourceBillNo: sSourceBillNo,
                            // HSourceBillType: sSourceBillType,
                            HStockOrgID: this.hform.HStockOrgID,
                            // HScanStyle: "",
                            // HCustom1: "",
                            // HCustom2: ""
                        },
                        success: (res) => {
                            console.log('扫码返回', res.data);
                            this.hform.HBarCode = ''
                            if (res.data.count == 1) {
                                CommonUtils.playSound(1);
                                var data = res.data.data
                                if (data.hBarTypeField == '仓库条码') {
                                    this.hform.HWHName = data.hWhNameField
                                    this.hform.HWHID = data.hWhIDField
                                    this.hform.HStockPlaceName = ''
                                    this.hform.HStockPlaceID = 0
                                    if (data.hSPFlagField == 0) {
                                        this.showHStockPlaceName = false
                                    } else {
                                        this.showHStockPlaceName = true
                                    }
                                } else if (data.hBarTypeField == '仓位条码') {
                                    this.hform.HWHName = data.hWhNameField
                                    this.hform.HWHID = data.hWhIDField
                                    this.hform.HStockPlaceName = data.hSPNameField
                                    this.hform.HStockPlaceID = data.hSPIDField
                                } else if (data.hBarTypeField == '部门条码') {
                                    this.hform.HDeptName = data.hDeptNameField
                    try {
                        let res = await CommonUtils.doRequest2Sync({
                            url: '/WEBSController/get_CheckTypeByBarCode_BillCheck_Json',
                            data: {
                                sBarCode: sBarCode,
                                HBillID: this.hform.HInterID || 0,
                                HBillType: this.hform.HBillType,
                                HBillNo: this.hform.HBillNo,
                                HMaker: this.hform.HMaker,
                                HWhID: sHWHID,
                                HSPID: sHSPID,
                                HQty: sHQty,
                                // HRedBlueFlag: this.hform.HRedBlueFlag,
                                // SourceFlag: HSourceFlag,
                                // HSourceBillNo: sSourceBillNo,
                                // HSourceBillType: sSourceBillType,
                                HStockOrgID: this.hform.HStockOrgID,
                                // HScanStyle: "",
                                // HCustom1: "",
                                // HCustom2: ""
                            },
                        })
                        if (!res) {
                            return
                        }
                        console.log('扫码返回', res.data);
                        this.hform.HBarCode = ''
                        if (res.data.count == 1) {
                            CommonUtils.playSound(1);
                            var data = res.data.data
                            if (data.hBarTypeField == '仓库条码') {
                                this.hform.HWHName = data.hWhNameField
                                this.hform.HWHID = data.hWhIDField
                                this.hform.HStockPlaceName = ''
                                this.hform.HStockPlaceID = 0
                                if (data.hSPFlagField == 0) {
                                    this.showHStockPlaceName = false
                                } else {
                                    this.showHStockPlaceName = true
                                }
                            } else if (data.hBarTypeField == '仓位条码') {
                                this.hform.HWHName = data.hWhNameField
                                this.hform.HWHID = data.hWhIDField
                                this.hform.HStockPlaceName = data.hSPNameField
                                this.hform.HStockPlaceID = data.hSPIDField
                            } else if (data.hBarTypeField == '部门条码') {
                                this.hform.HDeptName = data.hDeptNameField
                                this.hform.HDeptID = data.hDeptIDField
                                this.tabs = 1
                            } else if (data.hBarTypeField == '源单条码') {
                                this.hform.HSupName = data.hSupNameField
                                this.hform.HSupID = data.hSupIDField
                                if (data.hDeptIDField != 0) {
                                    this.hform.HDeptID = data.hDeptIDField
                                    this.tabs = 1
                                } else if (data.hBarTypeField == '源单条码') {
                                    this.hform.HDeptName = data.hDeptNameField
                                }
                                this.hform.HSourceBillNo = data.hSourceBillNoField
                                //获取源单类型、源单单号
                                if (data.hSourceBillTypeField == "1103") {
                                    this.HMainSourceBillType = '收料通知单'
                                    this.hform.HMainSourceBillType = 1103
                                    this.showHMainSourceBillType = false
                                } else if (data.hSourceBillTypeField == "1102") {
                                    this.HMainSourceBillType = '采购订单'
                                    this.hform.HMainSourceBillType = 1102
                                    this.showHMainSourceBillType = false
                                } else {
                                    this.HMainSourceBillType = '手工录入'
                                    this.hform.HMainSourceBillType = -1
                                    this.showHMainSourceBillType = false
                                }
                                if (data.hMulSourceFlagField == 0) {
                                    this.showHSourceBillNo = false
                                }
                                //供应商不可编辑
                                this.showHSupName = false
                                this.tabs = 2
                            } else { //物料条码
                                this.tabs = 2
                                console.log('data', data)
                                if (!this.hform.HSourceBillNo) {
                                    this.hform.HSupName = data.hSupNameField
                                    this.hform.HSupID = data.hSupIDField
                                    this.hform.HSourceBillNo = data.hSourceBillNoField
                                    if (data.hDeptIDField != 0) {
                                        this.hform.HDeptID = data.hDeptIDField
                                        this.hform.HDeptName = data.hDeptNameField
                                    }
                                    this.hform.HSourceBillNo = data.hSourceBillNoField
                                    //获取源单类型、源单单号
                                    this.hform.HMainSourceBillType = data.hSourceBillTypeField
                                    if (data.hSourceBillTypeField == "1103") {
                                        this.HMainSourceBillType = '收料通知单'
                                        this.hform.HMainSourceBillType = 1103
@@ -664,65 +796,162 @@
                                    }
                                    //供应商不可编辑
                                    this.showHSupName = false
                                    this.tabs = 2
                                } else { //物料条码
                                    this.tabs = 2
                                    console.log('data', data)
                                    if (!this.hform.HSourceBillNo) {
                                        this.hform.HSupName = data.hSupNameField
                                        this.hform.HSupID = data.hSupIDField
                                        this.hform.HSourceBillNo = data.hSourceBillNoField
                                        if (data.hDeptIDField != 0) {
                                            this.hform.HDeptID = data.hDeptIDField
                                            this.hform.HDeptName = data.hDeptNameField
                                        }
                                        //获取源单类型、源单单号
                                        this.hform.HMainSourceBillType = data.hSourceBillTypeField
                                        if (data.hSourceBillTypeField == "1103") {
                                            this.HMainSourceBillType = '收料通知单'
                                            this.hform.HMainSourceBillType = 1103
                                            this.showHMainSourceBillType = false
                                        } else if (data.hSourceBillTypeField == "1102") {
                                            this.HMainSourceBillType = '采购订单'
                                            this.hform.HMainSourceBillType = 1102
                                            this.showHMainSourceBillType = false
                                        } else {
                                            this.HMainSourceBillType = '手工录入'
                                            this.hform.HMainSourceBillType = -1
                                            this.showHMainSourceBillType = false
                                        }
                                        if (data.hMulSourceFlagField == 0) {
                                            this.showHSourceBillNo = false
                                        }
                                        //供应商不可编辑
                                        this.showHSupName = false
                                    }
                                }
                                //显示表体明细
                                this.DisBillEntryList()
                                //清空数量
                                this.hform.HQty = ''
                            } else {
                                CommonUtils.playSound(0);
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            }
                            this.refreshHBarCodeFocus()
                        },
                        fail: (res) => {
                            CommonUtils.playSound(0);
                            console.log(res);
                            //显示表体明细
                            this.DisBillEntryList()
                            //清空数量
                            this.hform.HQty = ''
                        } else {
                            CommonUtils.playSound(0);
                            uni.showToast({
                                title: '接口请求失败',
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                            this.refreshHBarCodeFocus()
                        },
                    });
                        this.refreshHBarCodeFocus()
                    } catch (e) {
                        this.playSound(0)
                        this.refreshHBillNoFocus()
                        uni.showToast({
                            title: '接口请求失败: ' + e,
                            icon: 'none'
                        })
                    }
                    // uni.request({
                    //     url: this.serverUrl + '/WEBSController/get_CheckTypeByBarCode_BillCheck_Json',
                    //     data: {
                    //         sBarCode: sBarCode,
                    //         HBillID: this.hform.HInterID || 0,
                    //         HBillType: this.hform.HBillType,
                    //         HBillNo: this.hform.HBillNo,
                    //         HMaker: this.hform.HMaker,
                    //         HWhID: sHWHID,
                    //         HSPID: sHSPID,
                    //         HQty: sHQty,
                    //         // HRedBlueFlag: this.hform.HRedBlueFlag,
                    //         // SourceFlag: HSourceFlag,
                    //         // HSourceBillNo: sSourceBillNo,
                    //         // HSourceBillType: sSourceBillType,
                    //         HStockOrgID: this.hform.HStockOrgID,
                    //         // HScanStyle: "",
                    //         // HCustom1: "",
                    //         // HCustom2: ""
                    //     },
                    //     success: (res) => {
                    //         console.log('扫码返回', res.data);
                    //         this.hform.HBarCode = ''
                    //         if (res.data.count == 1) {
                    //             CommonUtils.playSound(1);
                    //             var data = res.data.data
                    //             if (data.hBarTypeField == '仓库条码') {
                    //                 this.hform.HWHName = data.hWhNameField
                    //                 this.hform.HWHID = data.hWhIDField
                    //                 this.hform.HStockPlaceName = ''
                    //                 this.hform.HStockPlaceID = 0
                    //                 if (data.hSPFlagField == 0) {
                    //                     this.showHStockPlaceName = false
                    //                 } else {
                    //                     this.showHStockPlaceName = true
                    //                 }
                    //             } else if (data.hBarTypeField == '仓位条码') {
                    //                 this.hform.HWHName = data.hWhNameField
                    //                 this.hform.HWHID = data.hWhIDField
                    //                 this.hform.HStockPlaceName = data.hSPNameField
                    //                 this.hform.HStockPlaceID = data.hSPIDField
                    //             } else if (data.hBarTypeField == '部门条码') {
                    //                 this.hform.HDeptName = data.hDeptNameField
                    //                 this.hform.HDeptID = data.hDeptIDField
                    //                 this.tabs = 1
                    //             } else if (data.hBarTypeField == '源单条码') {
                    //                 this.hform.HSupName = data.hSupNameField
                    //                 this.hform.HSupID = data.hSupIDField
                    //                 if (data.hDeptIDField != 0) {
                    //                     this.hform.HDeptID = data.hDeptIDField
                    //                     this.hform.HDeptName = data.hDeptNameField
                    //                 }
                    //                 this.hform.HSourceBillNo = data.hSourceBillNoField
                    //                 //获取源单类型、源单单号
                    //                 if (data.hSourceBillTypeField == "1103") {
                    //                     this.HMainSourceBillType = '收料通知单'
                    //                     this.hform.HMainSourceBillType = 1103
                    //                     this.showHMainSourceBillType = false
                    //                 } else if (data.hSourceBillTypeField == "1102") {
                    //                     this.HMainSourceBillType = '采购订单'
                    //                     this.hform.HMainSourceBillType = 1102
                    //                     this.showHMainSourceBillType = false
                    //                 } else {
                    //                     this.HMainSourceBillType = '手工录入'
                    //                     this.hform.HMainSourceBillType = -1
                    //                     this.showHMainSourceBillType = false
                    //                 }
                    //                 if (data.hMulSourceFlagField == 0) {
                    //                     this.showHSourceBillNo = false
                    //                 }
                    //                 //供应商不可编辑
                    //                 this.showHSupName = false
                    //                 this.tabs = 2
                    //             } else { //物料条码
                    //                 this.tabs = 2
                    //                 console.log('data', data)
                    //                 if (!this.hform.HSourceBillNo) {
                    //                     this.hform.HSupName = data.hSupNameField
                    //                     this.hform.HSupID = data.hSupIDField
                    //                     this.hform.HSourceBillNo = data.hSourceBillNoField
                    //                     if (data.hDeptIDField != 0) {
                    //                         this.hform.HDeptID = data.hDeptIDField
                    //                         this.hform.HDeptName = data.hDeptNameField
                    //                     }
                    //                     //获取源单类型、源单单号
                    //                     this.hform.HMainSourceBillType = data.hSourceBillTypeField
                    //                     if (data.hSourceBillTypeField == "1103") {
                    //                         this.HMainSourceBillType = '收料通知单'
                    //                         this.hform.HMainSourceBillType = 1103
                    //                         this.showHMainSourceBillType = false
                    //                     } else if (data.hSourceBillTypeField == "1102") {
                    //                         this.HMainSourceBillType = '采购订单'
                    //                         this.hform.HMainSourceBillType = 1102
                    //                         this.showHMainSourceBillType = false
                    //                     } else {
                    //                         this.HMainSourceBillType = '手工录入'
                    //                         this.hform.HMainSourceBillType = -1
                    //                         this.showHMainSourceBillType = false
                    //                     }
                    //                     if (data.hMulSourceFlagField == 0) {
                    //                         this.showHSourceBillNo = false
                    //                     }
                    //                     //供应商不可编辑
                    //                     this.showHSupName = false
                    //                 }
                    //             }
                    //             //显示表体明细
                    //             this.DisBillEntryList()
                    //             //清空数量
                    //             this.hform.HQty = ''
                    //         } else {
                    //             CommonUtils.playSound(0);
                    //             uni.showToast({
                    //                 title: res.data.Message,
                    //                 icon: 'none'
                    //             })
                    //         }
                    //
                    //         this.refreshHBarCodeFocus()
                    //     },
                    //     fail: (res) => {
                    //         CommonUtils.playSound(0);
                    //         console.log(res);
                    //         uni.showToast({
                    //             title: '接口请求失败',
                    //             icon: 'none'
                    //         })
                    //
                    //         this.refreshHBarCodeFocus()
                    //     },
                    // });
                }
            },
            //物料信息
@@ -821,7 +1050,7 @@
                    url: '/pages/shengchanlingliao/form?OperationType=1'
                })
            },
            submit() {
            async submit() {
                if (this.hform.HInterID == 0 || !this.hform.HInterID) {
                    uni.showToast({
                        title: '没有扫码信息,请先扫描单据条码!',
@@ -855,49 +1084,99 @@
                            title: '请稍候'
                        })
                        var sMainStr = JSON.stringify(this.hform);
                        uni.request({
                            url: this.serverUrl + '/WEBSController/set_SaveMateOutBill_BillCheck_Json',
                            method: 'POST',
                            dataType: "json",
                            data: {
                                oMain: sMainStr
                            },
                            success: (res) => {
                                console.log(1, res);
                                uni.hideLoading()
                                if (res.data.count == 1) {
                                    uni.showModal({
                                        title: '提示',
                                        content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                                        success: (res) => {
                                            if (res.confirm) {
                                                console.log('用户点击确定');
                                                uni.redirectTo({
                                                    url: '/pages/shengchanlingliao/form?OperationType=1'
                                                })
                                            } else if (res.cancel) {
                                                console.log('用户点击取消');
                                                setTimeout(() => {
                                                    uni.navigateBack();
                                                }, 50)
                                            }
                        try {
                            let res = await CommonUtils.doRequest2Sync({
                                url: '/WEBSController/set_SaveMateOutBill_BillCheck_Json',
                                method: 'POST',
                                data: {
                                    oMain: sMainStr
                                },
                            })
                            if(!res) {
                                return
                            }
                            console.log(1, res);
                            uni.hideLoading()
                            if (res.data.count == 1) {
                                uni.showModal({
                                    title: '提示',
                                    content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                                    success: (res) => {
                                        if (res.confirm) {
                                            console.log('用户点击确定');
                                            uni.redirectTo({
                                                url: '/pages/shengchanlingliao/form?OperationType=1'
                                            })
                                        } else if (res.cancel) {
                                            console.log('用户点击取消');
                                            setTimeout(() => {
                                                uni.navigateBack();
                                            }, 50)
                                        }
                                    });
                                } else {
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                                    }
                                });
                            } else {
                                uni.showToast({
                                    title: '接口请求失败',
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            },
                        });
                            }
                        } catch (e) {
                            this.playSound(0)
                            this.refreshHBillNoFocus()
                            uni.showToast({
                                title: '接口请求失败: ' + e,
                                icon: 'none'
                            })
                        }
                        // uni.request({
                        //     url: this.serverUrl + '/WEBSController/set_SaveMateOutBill_BillCheck_Json',
                        //     method: 'POST',
                        //     dataType: "json",
                        //     data: {
                        //         oMain: sMainStr
                        //     },
                        //     success: (res) => {
                        //         console.log(1, res);
                        //         uni.hideLoading()
                        //         if (res.data.count == 1) {
                        //             uni.showModal({
                        //                 title: '提示',
                        //                 content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                        //                 success: (res) => {
                        //                     if (res.confirm) {
                        //                         console.log('用户点击确定');
                        //                         uni.redirectTo({
                        //                             url: '/pages/shengchanlingliao/form?OperationType=1'
                        //                         })
                        //                     } else if (res.cancel) {
                        //                         console.log('用户点击取消');
                        //                         setTimeout(() => {
                        //                             uni.navigateBack();
                        //                         }, 50)
                        //                     }
                        //                 }
                        //             });
                        //         } else {
                        //             uni.showToast({
                        //                 title: res.data.Message,
                        //                 icon: 'none'
                        //             })
                        //         }
                        //     },
                        //     fail: (res) => {
                        //         console.log(res);
                        //         uni.showToast({
                        //             title: '接口请求失败',
                        //             icon: 'none'
                        //         })
                        //     },
                        // });
                    }
                }
            },
utils/common.js
@@ -1,9 +1,11 @@
class commonUtils {
    serverUrl
    audioContext // 全局音频实例
    requestLock // 请求控制锁(同步)
    constructor() {
        this.serverUrl = uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API/';
        this.audioContext = null;
        this.requestLock = false
    }
    setServerUrl(url) {
@@ -303,6 +305,42 @@
        })
    }
    // 同步执行请求 (配合await或者then)
    async doRequest2Sync({
        url,
        data,
        method,
    }) {
        if(this.requestLock){
            console.warn("该请求被锁定,已退出请求!")
            return
        }
        this.requestLock = true
        return new Promise((resolve, reject) => {
            // that = that || this;
            let errorTip = null;
            uni.showLoading({
                title: '加载中...'
            })
            uni.request({
                method: method || "GET",
                url: this.serverUrl + url,
                data: data || "",
                success: (res) => {
                    resolve(res)
                },
                fail: (err) => {
                    reject(err)
                },
                complete: () => {
                    // 释放请求锁
                    this.requestLock = false
                    uni.hideLoading()
                }
            })
        })
    }
    stringToBoolean(str) {
        // 忽略大小写的转换
        return str?.toLowerCase() === "true";