chenhaozhe
2025-10-30 69360d971adb03d0f3f120096aa742d85f10160d
pages/caigourukujiaoyan/form.vue
@@ -4,7 +4,7 @@
         <view class="form-item">
            <view class="title">条码:</view>
            <view class="right">
               <input v-model="hform.HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(hform.HBarCode)" />
               <input  v-model="hform.HBarCode" :focus="HBarCodeFocus" placeholder="请扫描(或输入)条码" @blur="getCode(hform.HBarCode)"  />
            </view>
            <uni-icons type="scan"
               style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
@@ -45,7 +45,7 @@
               <view class="title">单据号:</view>
               <view class="right" style="width: 380rpx;">
                  <input name="HBillNo" v-model="hform.HBillNo" placeholder="请扫描(或输入)条码"
                     @confirm="GetMeesageByBillNo(hform.HBarCode)" />
                      :focus="HBillNoFocus" @blur="GetMeesageByBillNo()"/>
               </view>
               <uni-icons type="scan"
                  style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
@@ -81,8 +81,8 @@
         </view>
         <view v-if="tabs == 2">
            <view class="list" v-for="(item,index) in Materlist" :key="index">
               <uni-card :title="item.物料名称" :extra="'数量:'+item.数量" style="margin: 10px;" @tap="delMater(item)">
                  <view class="card-detail">
                    <uni-card :title="item.物料名称" :extra="'数量:'+item.数量" style="margin: 10px;" @tap="delMater(item)">
                        <view class="card-detail">
                     <view class="detail">
                        <text>物料代码:</text>{{item.物料代码}}
                     </view>
@@ -188,6 +188,9 @@
   export default {
      data() {
         return {
                HBarCodeFocus: false,
                HBillNoFocus: false,
            userInfo: getUserInfo(),
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            HModName: 'Kf_POStockInBill_CheckList_PDA',
@@ -249,86 +252,178 @@
            // this.getNewData()
         }
         this.getHBaseList()
            this.refreshHBillNoFocus()
      },
      methods: {
         handleInput(event) {
           // 这里可以添加额外的逻辑处理,比如校验或进一步的操作
           console.log(event.target.value);
         },
            // 刷新单据号聚焦
            async refreshHBillNoFocus() {
                this.HBillNoFocus = false
                this.hform.HBillNo = '',
                await this.$nextTick()
                this.HBillNoFocus = true
            },
            // 刷新条码聚焦
            async refreshHBarCodeFocus() {
                this.HBarCodeFocus = false
                this.hform.HBarCode = ''
                // this.$nextTick(() => {
                //     this.HBarCodeFocus = true
                // })
            setTimeout(() => {
              this.HBarCodeFocus = true;
            }, 300);
            },
         //扫码
         toScanCode() {
            uni.scanCode({
               onlyFromCamera: true,
               success: (res) => {
                  console.log('条码内容:' + res.result);
                  // if(this.hform.HBarCode == '*'){
                  //    this.hform.HBarCode = this.hform.HBarCode + res.result
                  // }else{
                  //    this.hform.HBarCode = res.result
                  // }
                  this.hform.HBarCode = res.result
                  // this.GetMeesageByBillNo(this.hform.HBarCode)
                  this.getCode(this.hform.HBarCode)
               }
            });
            var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
            mpaasScanModule.mpaasScan({
               'hideAlbum': true,
               'timeoutInterval':'10', //超时时间
               'timeoutText':'未识别到二维码' //超时提醒
            },(ret) => {
               console.log(ret.resp_result)
               // if(this.hform.HBarCode == '*'){
               //    this.hform.HBarCode = this.hform.HBarCode + ret.resp_result
               // }else{
               //    this.hform.HBarCode = ret.resp_result
               // }
               this.hform.HBarCode = ret.resp_result
               // this.GetMeesageByBillNo(this.hform.HBarCode)
               this.getCode(this.hform.HBarCode)
            })
         },
         toScanBillCode() {
            uni.scanCode({
               onlyFromCamera: true,
               success: (res) => {
                  console.log('条码内容:' + res.result);
                  // if(this.hform.HBarCode == '*'){
                  //    this.hform.HBarCode = this.hform.HBarCode + res.result
                  // }else{
                  //    this.hform.HBarCode = res.result
                  // }
                  this.hform.HBillNo = res.result
                  this.GetMeesageByBillNo(this.hform.HBillNo)
               }
            });
            var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
            mpaasScanModule.mpaasScan({
               'hideAlbum': true,
               'timeoutInterval':'10', //超时时间
               'timeoutText':'未识别到二维码' //超时提醒
            },(ret) => {
               console.log(ret.resp_result)
               // if(this.hform.HBarCode == '*'){
               //    this.hform.HBarCode = this.hform.HBarCode + ret.resp_result
               // }else{
               //    this.hform.HBarCode = ret.resp_result
               // }
               this.hform.HBillNo = ret.resp_result
               this.GetMeesageByBillNo(this.hform.HBillNo)
            })
         },
         //扫描单据号条码
         GetMeesageByBillNo(e) {
            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();
                  } else {
                     CommonUtils.playSound(0);
                     uni.showToast({
                        title: res.data.Message,
                        icon: 'none'
                     })
                     this.hform.HBillNo = ''
                  }
               },
               fail: (res) => {
                  CommonUtils.playSound(0);
                  console.log(res);
                  uni.showToast({
                     title: '接口请求失败',
                     icon: 'none'
                  })
               },
            });
         },
            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()
                        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({
@@ -415,195 +510,379 @@
               }
            }
         },
         getCode(HBarCode) {
            //仓库、仓位文本框为空时,清空对应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'
                        })
                     }
                  },
                  fail: (res) => {
                     CommonUtils.playSound(0);
                     console.log(res);
                     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.refreshHBarCodeFocus()
                         //清空数量
                         this.hform.HQty = ''
                     } else {
                         CommonUtils.playSound(0);
                     this.refreshHBarCodeFocus()
                         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/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() {
@@ -695,91 +974,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({