From 12c64fd30867081a01a00ef8a8efd7e71ca83daa Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 15 九月 2025 11:22:34 +0800
Subject: [PATCH] 所有 校验单据模块 添加 条码扫码 数量填写 仓库选择和仓位选择

---
 pages/shengchandiaobo/form.vue |  368 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 364 insertions(+), 4 deletions(-)

diff --git a/pages/shengchandiaobo/form.vue b/pages/shengchandiaobo/form.vue
index c72b4fe..e004653 100644
--- a/pages/shengchandiaobo/form.vue
+++ b/pages/shengchandiaobo/form.vue
@@ -1,6 +1,39 @@
 <template>
     <view>
         <view class="form">
+            <view class="form-item">
+                <view class="title">鏉$爜:</view>
+                <view class="right">
+                    <input :focus="BarCodeFocus" v-model="hform.HBarCode" placeholder="璇锋壂鎻�(鎴栬緭鍏�)鏉$爜"
+                        @confirm="getCode(hform.HBarCode)" />
+                </view>
+                <uni-icons type="scan"
+                    style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
+                    size="20" @click="toScanHBarCode"></uni-icons>
+            </view>
+            <view class="form-item">
+                <view class="title">鏁伴噺:</view>
+                <view class="right">
+                    <input v-model="hform.HQty" placeholder="璇疯緭鍏ユ暟閲�" />
+                </view>
+            </view>
+            <view class="form-item">
+                <view class="title">浠撳簱:</view>
+                <view class="right">
+                    <uni-combox :candidates="arrayHWHName" placeholder="璇疯緭鍏�(鎴栨壂鎻�)浠撳簱" v-model="hform.HWHName"
+                        @input="HWHNameChange"></uni-combox>
+                </view>
+            </view>
+            <view class="form-item">
+                <view class="title">浠撲綅:</view>
+                <view class="right" v-show="showHStockPlaceName">
+                    <uni-combox :candidates="arrayHStockPlaceName" placeholder="璇疯緭鍏�(鎴栨壂鎻�)浠撲綅"
+                        v-model="hform.HStockPlaceName" @input="HStockPlaceNameChange"></uni-combox>
+                </view>
+                <view class="righton" v-show="!showHStockPlaceName">
+                    <input v-model="hform.HStockPlaceName" :disabled="!showHStockPlaceName" placeholder="涓嶅彲鎿嶄綔" />
+                </view>
+            </view>
             <view class="tabs">
                 <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">琛ㄥご淇℃伅</view>
                 <view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">鐗╂枡淇℃伅</view>
@@ -184,6 +217,7 @@
     import {
         getUserInfo
     } from "@/utils/auth.js";
+    import { CommonUtils } from '../../utils/common';
     export default {
         data() {
             return {
@@ -194,11 +228,19 @@
                 HModName: 'Kf_MoveStockBill_Check_PDA',
                 ModRightName: 'CE_MoveStockCheck',
                 OperationType: 1,
-
+                
+                showHStockPlaceName: false,
+                HBillNoFocus: false,
+                BarCodeFocus: false,
                 showHBillNo: true,
                 tabs: 1,
                 linterid: '',
                 HBillNo: '',
+                
+                arrayHWHName: [], //浠撳簱
+                HWHNameList: [],
+                arrayHStockPlaceName: [], //浠撲綅
+                HStockPlaceNameList: [],
 
                 Materlist: [],
                 hform: {
@@ -248,8 +290,110 @@
             } else {
                 this.refreshHBillNoFocus()
             }
+
+            this.getHBaseList()
         },
         methods: {
+            async refreshHBillState() {
+                this.HBillNoFocus = false
+                await this.$nextTick(() => {
+                    this.hform.HBillNo = ""
+                    this.HBillNoFocus = true
+
+                })
+            },
+            async refreshBarCodeState() {
+                this.BarCodeFocus = false
+                await this.$nextTick(() => {
+                    this.hform.HBarCode = ""
+                    this.BarCodeFocus = true
+                })
+            },
+            getHBaseList() {
+                uni.request({
+                    url: this.serverUrl + '/Gy_Warehouse/list',
+                    data: {
+                        sWhere: "",
+                        user: uni.getStorageSync('HUserName'),
+                        Organization: uni.getStorageSync('Organization')
+                    },
+                    success: (res) => {
+                        if (res.data.count == 1) {
+                            this.HWHNameList = res.data.data
+                            for (var i = 0; i < res.data.data.length; i++) {
+                                this.arrayHWHName[i] = res.data.data[i].浠撳簱鍚嶇О
+                            }
+                        } else {
+                            uni.showToast({
+                                title: '浠撳簱鏁版嵁璇锋眰澶辫触',
+                                icon: 'none'
+                            })
+                        }
+                    },
+                    fail: (res) => {
+                        console.log(res);
+                        uni.showToast({
+                            title: '鎺ュ彛璇锋眰澶辫触',
+                            icon: 'none'
+                        })
+                    },
+                });
+
+                uni.request({
+                    url: this.serverUrl + '/Gy_StockPlace/list',
+                    data: {
+                        sWhere: "",
+                        user: uni.getStorageSync('HUserName'),
+                        Organization: uni.getStorageSync('Organization')
+                    },
+                    success: (res) => {
+                        if (res.data.count == 1) {
+                            this.HStockPlaceNameList = res.data.data
+                            for (var i = 0; i < res.data.data.length; i++) {
+                                this.arrayHStockPlaceName[i] = res.data.data[i].浠撲綅鍚嶇О
+                            }
+                        } else {
+                            uni.showToast({
+                                title: '浠撲綅鏁版嵁璇锋眰澶辫触',
+                                icon: 'none'
+                            })
+                        }
+                    },
+                    fail: (res) => {
+                        console.log(res);
+                        uni.showToast({
+                            title: '鎺ュ彛璇锋眰澶辫触',
+                            icon: 'none'
+                        })
+                    },
+                });
+            },
+            //閫夋嫨浠撳簱
+            HWHNameChange(e) {
+                // var name = e.split("(")
+                for (var i = 0; i < this.HWHNameList.length; i++) {
+                    if (this.HWHNameList[i].浠撳簱鍚嶇О == e) {
+                        this.hform.HWHName = this.HWHNameList[i].浠撳簱鍚嶇О
+                        this.hform.HWHID = this.HWHNameList[i].HItemID
+
+                        if (this.HWHNameList[i]['鍚敤浠撲綅'] == 'Y') {
+                            this.showHStockPlaceName = true
+                        } else {
+                            this.hform.HStockPlaceName = ''
+                            this.showHStockPlaceName = false
+                        }
+                    }
+                }
+            },
+            //閫夋嫨浠撲綅
+            HStockPlaceNameChange(e) {
+                for (var i = 0; i < this.HStockPlaceNameList.length; i++) {
+                    if (this.HStockPlaceNameList[i].浠撲綅鍚嶇О == e) {
+                        this.hform.HStockPlaceName = this.HStockPlaceNameList[i].浠撲綅鍚嶇О
+                        this.hform.HStockPlaceID = this.HStockPlaceNameList[i].HItemID
+                    }
+                }
+            },
             async refreshHBillNoFocus() {
                 this.HBillNoFocus = false
                 await this.$nextTick(() => {
@@ -265,6 +409,23 @@
                     innerAudioContext.src = '/static/jingbao.wav';
                 }
                 innerAudioContext.play(); // 鎾斁闊抽
+            },
+            toScanHBarCode() {
+                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.getCode(this.hform.HBarCode)
+                })
             },
             //鎵爜
             toScanCode() {
@@ -330,6 +491,203 @@
                     },
                 });
             },
+            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()
+                                    CommonUtils.playSound(1)
+                                } else {
+                                    CommonUtils.playSound(0)
+                                    this.refreshBarCodeState()
+                                    uni.showToast({
+                                        title: res.data.Message,
+                                        icon: 'none'
+                                    })
+                                }
+                            },
+                            fail: (res) => {
+                                console.log(res);
+                                this.refreshBarCodeState()
+                                CommonUtils.playSound(0)
+                                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
+                                    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)
+                                this.refreshBarCodeState()
+                                uni.showToast({
+                                    title: res.data.Message,
+                                    icon: 'none'
+                                })
+                            }
+                        },
+                        fail: (res) => {
+                            CommonUtils.playSound(0)
+                            this.refreshBarCodeState()
+                            console.log(res);
+                            uni.showToast({
+                                title: '鎺ュ彛璇锋眰澶辫触',
+                                icon: 'none'
+                            })
+                        },
+                    });
+                }
+            },
             //鐗╂枡淇℃伅
             DisBillEntryList() {
                 uni.request({
@@ -346,6 +704,7 @@
                             var data = res.data.data
                             this.Materlist = data.Materlist
                             if (!data.BarCodeDetailslist[0].HBarCode) {
+                                this.hform.HBarCode_B = ''
                                 this.hform.HMaterName_B = ''
                                 this.hform.HMaterModel_B = ''
                                 this.hform.HBatchNo_B = ''
@@ -357,6 +716,7 @@
                                 this.hform.HSCWHName_B = ''
                                 this.hform.HSCSPName_B = ''
                             } else {
+                                this.hform.HBarCode_B = data.BarCodeDetailslist[0].HBarCode
                                 this.hform.HMaterName_B = data.BarCodeDetailslist[0].HMaterName
                                 this.hform.HMaterModel_B = data.BarCodeDetailslist[0].HMaterModel
                                 this.hform.HBatchNo_B = data.BarCodeDetailslist[0].HBatchNo
@@ -546,20 +906,20 @@
         }
 
         .right {
-            width: 450rpx;
+            flex: 1;
             border-radius: 22rpx;
             border: 1px solid #acacac;
         }
 
         .righton {
-            width: 450rpx;
+            flex: 1;
             border-radius: 22rpx;
             border: 1px solid #e4e4e4;
             background-color: #e4e4e4;
         }
 
         input {
-            width: 100%;
+            width: inherit;
             padding: 8rpx 20rpx;
             font-size: 30rpx;
         }

--
Gitblit v1.9.1