From 77e696ef8693d054ff78154a6a97794aff21d74a Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期四, 04 十二月 2025 14:04:35 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev

---
 pages/fenbushidiaochudan/form_out.vue |  205 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 126 insertions(+), 79 deletions(-)

diff --git a/pages/fenbushidiaochudan/form_out.vue b/pages/fenbushidiaochudan/form_out.vue
index 738637f..ac3ab31 100644
--- a/pages/fenbushidiaochudan/form_out.vue
+++ b/pages/fenbushidiaochudan/form_out.vue
@@ -401,8 +401,7 @@
                 arrayHMainSourceBillType: ['鍙戣揣閫氱煡鍗�', '璋冩嫧鐢宠鍗�',
                      '鎵嬪伐褰曞叆'
                 ],
-                arrayHMainSourceBillValue: [1402, 1243, 3720, 1604,
-                    1214, 3721, 1242, -1
+                arrayHMainSourceBillValue: [1402, 1243, -1
                 ],
 
                 linterid: '',
@@ -442,6 +441,9 @@
                 Materlist: [],
                 FIFOlist: [],
                 hform: {
+                    inOrgID: '',
+                    outOrgID: '',
+
                     HBillType: 1250,
                     HBillSubType: "",
                     HBillerID: uni.getStorageSync('HBillerID'),
@@ -535,10 +537,28 @@
             this.getRelationStore()
             this.GetSourceBillType()
 
-            uni.$on('BillSelectComplete', (e) => {
+            uni.$on('BillSelectComplete', async (e) => {
                 console.log("鎺ユ敹鍒扮殑娑堟伅: ", e.HBillNo)
-                this.getHBarCodeData(e.HBillNo)
-                this.$refs.billList.exit()
+                try {
+                    // 绛夊緟鑾峰彇婧愬崟鏁版嵁骞跺洖濉〃澶�
+                    await this.getHBarCodeData(e.HBillNo)
+
+                    // 濡傛灉婧愬崟绫诲瀷鏄� 璋冩嫧鐢宠鍗曪紙鍊煎彲鑳芥槸 1243锛夛紝鍒欐牴鎹繑鍥炵殑璋冨叆缁勭粐鍒锋柊璋冨叆缁勭粐鍚嶇О鍙婁粨搴�
+                    const isApplyTransfer = (this.hform.HMainSourceBillType == 1243) || (this.HMainSourceBillType == '璋冩嫧鐢宠鍗�')
+                    if (isApplyTransfer) {
+                        // hform.HStockInOrgID 宸插湪 getHBarCodeData 涓洖濉紙鑻ユ帴鍙h繑鍥烇級锛岃繖閲屾牴鎹� ID 鎵惧埌鍚嶇О骞舵洿鏂颁粨搴撳垪琛�
+                        const inOrgIndex = this.arrayHOrgValue.findIndex(v => v == this.hform.HStockInOrgID)
+                        if (inOrgIndex != -1) {
+                            this.hform.HStockInOrgName = this.arrayHOrgName[inOrgIndex]
+                        }
+                        // 鍒锋柊璋冨叆浠撳簱锛堜紶鍏ョ粍缁囧悕绉版垨榛樿 organization锛�
+                        this.getHWarehouseInList(this.hform.HStockInOrgName || uni.getStorageSync('Organization'))
+                    }
+                } catch (err) {
+                    console.warn('鑾峰彇婧愬崟鍥炲~澶辫触: ', err)
+                } finally {
+                    this.$refs.billList.exit()
+                }
             })
         },
         onUnload() {
@@ -1124,6 +1144,10 @@
 
                             this.arrayHMainSourceBillType.push('鎵嬪伐褰曞叆')
                             this.arrayHMainSourceBillValue.push('-1')
+							this.arrayHMainSourceBillType.push('鍙戣揣閫氱煡鍗�')
+							this.arrayHMainSourceBillValue.push('1402')
+							this.arrayHMainSourceBillType.push('璋冩嫧鐢宠鍗�')
+							this.arrayHMainSourceBillValue.push('1243')
                             //濡傛灉鎵嬪伐褰曞叆涓嶇敤閫夋嫨婧愬崟
                             if (this.arrayHMainSourceBillType[0] == '鎵嬪伐褰曞叆') {
                                 this.tabs = 1
@@ -1405,49 +1429,85 @@
             },
             //閫変腑婧愬崟
             getHBarCodeData(HBarCode) {
-                if (!this.hform.HFIFOWHName) {
-                    this.hform.HFIFOWHID = 0
-                }
-                uni.request({
-                    url: this.serverUrl + '/WEBSController/get_SourceBarCode_MoveStock_Json',
-                    data: {
-                        HInterID: this.hform.HInterID,
-                        HBillNo: this.hform.HBillNo,
-                        HBillType: this.hform.HBillType,
-                        HSourceBillNo: HBarCode,
-                        HSourceBillType: this.hform.HMainSourceBillType,
-                        HMaker: this.hform.HMaker,
-                        HOWNERID: this.hform.HStockOrgID,
-                        HFIFOWhID: this.hform.HFIFOWHID,
-                        // HPTQty: this.hform.HPTQty || 0,
-                        // HPlanMode: this.hform.HPlanMode || 0
-                    },
-                    success: (res) => {
-                        if (res.data.count == 1) {
-                            var data = res.data.data
-                            console.log(2, data);
-                            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
-                            this.showHMainSourceBillType = false
-                            if (data.hMulSourceFlagField == 0) {
-                                this.showHSourceBillNo = false
-                            }
-                            this.tabs = 2
-                            this.showHSupName = false
-                            this.barCodeFocus = true
-                            this.playSound(1)
-                            this.DisBillEntryList()
-                        } else {
-                            this.playSound(0)
-                            console.log('res: ', res);
+                return new Promise((resolve, reject) => {
+                    if (!this.hform.HFIFOWHName) {
+                        this.hform.HFIFOWHID = 0
+                    }
+                    uni.request({
+                        url: this.serverUrl + '/WEBSController/get_SourceBarCode_MoveStock_Json',
+                        data: {
+                            HInterID: this.hform.HInterID,
+                            HBillNo: this.hform.HBillNo,
+                            HBillType: this.hform.HBillType,
+                            HSourceBillNo: HBarCode,
+                            HSourceBillType: this.hform.HMainSourceBillType,
+                            HMaker: this.hform.HMaker,
+                            HOWNERID: this.hform.HStockOrgID,
+                            HFIFOWhID: this.hform.HFIFOWHID,
+                            // HPTQty: this.hform.HPTQty || 0,
+                            // HPlanMode: this.hform.HPlanMode || 0
+                        },
+                        success: (res) => {
+                            if (res.data.count == 1) {
+                                var data = res.data.data
+                                console.log(2, data);
+                                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
+                                this.showHMainSourceBillType = false
+                                this.hform.HStockStyle = data.hStockStyleField
+                                if (data.hMulSourceFlagField == 0) {
+                                    this.showHSourceBillNo = false
+                                }
 
+                                // 濡傛灉鎺ュ彛杩斿洖浜嗙粍缁囩浉鍏冲瓧娈碉紝鍒欏~鍏呰皟鍏�/璋冨嚭缁勭粐
+                                if (data.hStockInOrgIDField !== undefined || data.hStockOutOrgIDField !== undefined) {
+                                    // 鏈変簺鎺ュ彛杩斿洖瀛楁鍚嶅彲鑳戒笉鍚岋紝鍏煎澶勭悊
+                                    this.hform.inOrgID = data.hStockInOrgIDField || data.HStockInOrgID || data.HStockInOrgId
+                                    this.hform.outOrgID = data.hStockOutOrgIDField || data.HStockOutOrgID || data.HStockOutOrgId
+                                    if (this.hform.inOrgID !== undefined && this.hform.inOrgID !== null) {
+                                        this.hform.HStockInOrgID = this.hform.inOrgID
+                                        const idx = this.arrayHOrgValue.findIndex(e => e == this.hform.inOrgID)
+                                        if (idx != -1) this.hform.HStockInOrgName = this.arrayHOrgName[idx]
+                                    }
+                                    if (this.hform.outOrgID !== undefined && this.hform.outOrgID !== null) {
+                                        this.hform.HStockOutOrgID = this.hform.outOrgID
+                                        const idx2 = this.arrayHOrgValue.findIndex(e => e == this.hform.outOrgID)
+                                        if (idx2 != -1) this.hform.HStockOutOrgName = this.arrayHOrgName[idx2]
+                                    }
+                                }
+
+                                this.tabs = 2
+                                this.showHSupName = false
+                                this.barCodeFocus = true
+                                this.playSound(1)
+                                this.DisBillEntryList()
+                                resolve(res.data.data)
+                            } else {
+                                this.playSound(0)
+                                console.log('res: ', res);
+
+                                uni.showToast({
+                                    title: res.data.Message,
+                                    icon: 'none'
+                                })
+                                this.HSourcebillNoFocus = false
+                                this.$nextTick(() => {
+                                    this.hform.HSourceBillNo = ""
+                                    this.HSourcebillNoFocus = true
+                                })
+                                reject(res.data.Message)
+                            }
+                        },
+                        fail: (err) => {
+                            console.log('err: ', err);
+                            this.playSound(0)
                             uni.showToast({
-                                title: res.data.Message,
+                                title: '鎺ュ彛璇锋眰澶辫触',
                                 icon: 'none'
                             })
                             this.HSourcebillNoFocus = false
@@ -1455,22 +1515,10 @@
                                 this.hform.HSourceBillNo = ""
                                 this.HSourcebillNoFocus = true
                             })
-                        }
-                    },
-                    fail: (err) => {
-                        console.log('err: ', err);
-                        this.playSound(0)
-                        uni.showToast({
-                            title: '鎺ュ彛璇锋眰澶辫触',
-                            icon: 'none'
-                        })
-                        this.HSourcebillNoFocus = false
-                        this.$nextTick(() => {
-                            this.hform.HSourceBillNo = ""
-                            this.HSourcebillNoFocus = true
-                        })
-                    },
-                });
+                            reject(err)
+                        },
+                    });
+                })
             },
             //鎵潯鐮佸鐞�
             async getCode(HBarCode) {
@@ -1588,7 +1636,7 @@
                         sHQty = 0;
                     }
                     try {
-
+                        
                         let res = await CommonUtils.doRequest2Sync({
                             url: '/WEBSController/get_BarCode_MoveStock_New_Json',
                             data: {
@@ -1606,14 +1654,14 @@
                                 SourceFlag: HSourceFlag,
                                 HSourceBillNo: sSourceBillNo,
                                 HSourceBillType: sSourceBillType,
-                                HStockInOrgID: this.hform.HStockOrgID,
-                                HStockOutOrgID: this.hform.HStockOutOrgID,
+                                HStockInOrgID: this.hform.inOrgID||this.hform.HStockInOrgID,
+                                HStockOutOrgID: this.hform.outOrgID||this.hform.HStockOutOrgID,
                                 HScanStyle: "",
                                 HCustom1: "",
                                 HCustom2: ""
                             },
                         })
-
+                        console.log('fanhuizuzhi ', this.hform.inOrgID,this.hform.outOrgID);
                         if (!res) {
                             return
                         }
@@ -2131,14 +2179,14 @@
                                     this.showHSupName = false
                                 }
                             }
-                            // if (data.HSourceBillType == 1402) {
-                            // 	this.hform.HMainSourceBillType = 1402
-                            // 	this.HMainSourceBillType = '鍙戣揣閫氱煡鍗�'
-                            // 	this.showHSupName = false
-                            // } else if (data.HSourceBillType == 1243) {
-                            // 	this.hform.HMainSourceBillType = 1243
-                            // 	this.HMainSourceBillType = '璋冩嫧鐢宠鍗�'
-                            // 	this.showHSupName = false
+                            if (data.HSourceBillType == 1402) {
+                            	this.hform.HMainSourceBillType = 1402
+                            	this.HMainSourceBillType = '鍙戣揣閫氱煡鍗�'
+                            	this.showHSupName = false
+                            } else if (data.HSourceBillType == 1243) {
+                            	this.hform.HMainSourceBillType = 1243
+                            	this.HMainSourceBillType = '璋冩嫧鐢宠鍗�'
+                            	this.showHSupName = false
                             // } else if (data.HSourceBillType == 3720) {
                             // 	this.hform.HMainSourceBillType = 3720
                             // 	this.HMainSourceBillType = '鐢熶骇鐢ㄦ枡娓呭崟'
@@ -2159,10 +2207,10 @@
                             // 	this.hform.HMainSourceBillType = 1242
                             // 	this.HMainSourceBillType = '鍑哄簱鐢宠鍗�'
                             // 	this.showHSupName = false
-                            // } else {
-                            // 	this.hform.HMainSourceBillType = -1
-                            // 	this.HMainSourceBillType = '鎵嬪伐褰曞叆'
-                            // }
+                            } else {
+                            	this.hform.HMainSourceBillType = -1
+                            	this.HMainSourceBillType = '鎵嬪伐褰曞叆'
+                            }
                             this.showHMainSourceBillType = false
 
                             //闈炲婧愬崟妯″紡
@@ -2174,7 +2222,6 @@
                             this.hform.HSupID = data.HCusID
                             this.hform.HSupName = data.HCusName
                             this.hform.HStockStyle = data.HStockStyle
-
                             let HStockInOrgIndex = this.arrayHOrgValue.findIndex(e => e == data
                                 .HStockInOrgID)
                             let HStockOutOrgIndex = this.arrayHOrgValue.findIndex(e => e == data

--
Gitblit v1.9.1