chenhaozhe
2025-08-12 5070a2136a290d2de489cdb7b4d2ae7bc094a91e
pages/shengchanrukushengdan/form.vue
@@ -288,7 +288,9 @@
        getUserInfo
    } from "@/utils/auth.js";
    import BillListPopupVue from '../../components/BillListPopup/BillListPopup.vue';
    export default {
    import { CommonUtils } from '../../utils/common';
   import {getUserStockRelation} from "@/utils/userRelationManager.js"
   export default {
        data() {
            return {
                userInfo: getUserInfo(),
@@ -309,7 +311,7 @@
                tabs: 0,
                HMainSourceBillType: '生产订单',
                arrayHMainSourceBillType: ['生产订单', '生产汇报单', '工序汇报单', '手工录入'],
            arrayHMainSourceBillValue: [3710, 3711, 3714],
                linterid: '',
                HBillNo: '',
                btnType: 0, //0新增,1修改,2审核,3反审核
@@ -390,10 +392,13 @@
                this.HSourceBillNoFocus = true
                this.getNewData()
            }
            this.getHBaseList()
            // this.getHBaseList()
            this.getHSupList()
            this.getHEmpList()
            this.getHDeptList()
         this.GetSourceBillType()
         this.getRelationStore()
            uni.$on('BillSelectComplete', (e) => {
                console.log("接收到的消息: ", e.HBillNo)
@@ -405,6 +410,27 @@
            uni.$off('BillSelectComplete')
        },
        methods: {
         async getRelationStore() {
            let {
               data,
               count
            } = await getUserStockRelation()
            if (count == 1) {
               let WHIDList = []
               Array.from(data).forEach(elem => {
                  WHIDList.push(elem.HItemID)
               })
               let sWhere = ` and HItemID in (${WHIDList.join(",")})`
               this.getHBaseList({
                  sWhere: sWhere
               })
            } else {
               this.getHBaseList()
            }
         },
            async refreshHSourceBillState() {
                this.HSourceBillNoFocus = false
                await this.$nextTick(() => {
@@ -421,6 +447,11 @@
                })
            },
            onHSourceBillNoConfirmHandler() {
            if (this.hform.HMainSourceBillType == -1) {
               // 手工录入不进行提交
               this.playSound(1)
               return
            }
                this.getHBarCodeData(this.hform.HSourceBillNo)
            },
            playSound(e) {
@@ -532,11 +563,11 @@
                this.hform.HDate = e.detail.value
            },
            //基础仓库资料
            getHBaseList() {
            getHBaseList({sWhere = ''} = {}) {
                uni.request({
                    url: this.serverUrl + '/Gy_Warehouse/list',
                    data: {
                        sWhere: "",
                        sWhere: sWhere,
                        user: uni.getStorageSync('HUserName'),
                        Organization: uni.getStorageSync('Organization')
                    },
@@ -591,9 +622,46 @@
                    },
                });
                this.getHYDList()
                // this.getHYDList()
            },
         // 通过单据类型获取源单类型
         async GetSourceBillType() {
            CommonUtils.doRequest2({
               url: '/Web/GetHSourceBillTypeByBillType',
               data: {
                  HBillType: this.hform.HBillType,
                  Num: 2
               },
               resFunction: (res) => {
                  let {
                     data,
                     count,
                     Message
                  } = res.data
                  if (count == 1) {
                     console.log('data: ', data);
                     this.arrayHMainSourceBillType = []
                     this.arrayHMainSourceBillValue = []
                     Array.from(data).forEach(e => {
                        this.arrayHMainSourceBillType.push(e['HSourceBillTypeName'])
                        this.arrayHMainSourceBillValue.push(e['HSourceBillType'])
                     })
                     this.arrayHMainSourceBillType.push('手工录入')
                     this.arrayHMainSourceBillValue.push('-1')
                     this.HMainSourceBillType = this.arrayHMainSourceBillType[0]
                     this.hform.HMainSourceBillType = this.arrayHMainSourceBillValue[0]
                  } else {
                     uni.showToast({
                        icon: 'none',
                        title: Message
                     })
                  }
               }
            })
         },
            //源单资料
            getHYDList() {
                uni.request({
@@ -679,18 +747,10 @@
            //选择源单类型
            HMainSourceBillTypeChange(e) {
                this.HMainSourceBillType = this.arrayHMainSourceBillType[e.detail.value]
                if (this.HMainSourceBillType == '生产订单') {
                    this.hform.HMainSourceBillType = 3710
                    this.getHYDList()
                } else if (this.HMainSourceBillType == '生产汇报单') {
                    this.hform.HMainSourceBillType = 3711
                    this.getHYDList()
                } else if (this.HMainSourceBillType == '工序汇报单') {
                    this.hform.HMainSourceBillType = 3714
                    this.getHYDList()
                } else {
                    this.hform.HMainSourceBillType = -1
                    this.getHYDList()
                let index = this.arrayHMainSourceBillType.findIndex(e => e == this.HMainSourceBillType)
                if (index != -1) {
                   this.hform.HMainSourceBillType = this.arrayHMainSourceBillValue[index]
                   // this.getHYDList()
                }
            },
@@ -1008,23 +1068,31 @@
                                    this.hform.HSourceBillNo = data.hSourceBillNoField
                                    //获取源单类型、源单单号
                                    this.hform.HMainSourceBillType = data.hSourceBillTypeField
                                    if (data.hSourceBillTypeField == "3710") {
                                        this.HMainSourceBillType = '生产订单'
                                        this.hform.HMainSourceBillType = 3710
                                        this.showHMainSourceBillType = false
                                    } else if (data.hSourceBillTypeField == "3711") {
                                        this.HMainSourceBillType = '生产汇报单'
                                        this.hform.HMainSourceBillType = 3711
                                        this.showHMainSourceBillType = false
                                    } else if (data.hSourceBillTypeField == "3714") {
                                        this.HMainSourceBillType = '工序汇报单'
                                        this.hform.HMainSourceBillType = 3714
                                        this.showHMainSourceBillType = false
                                    } else {
                                        this.HMainSourceBillType = '手工录入'
                                        this.hform.HMainSourceBillType = -1
                                        this.showHMainSourceBillType = false
                                    }
                           let index = this.arrayHMainSourceBillValue.findIndex(e => e = data
                              .hSourceBillTypeField)
                           if (index != -1) {
                              this.HMainSourceBillType = this.arrayHMainSourceBillType[index]
                              this.hform.HMainSourceBillType = data.hSourceBillTypeField
                              this.showHMainSourceBillType = false
                           }
                           // if (data.hSourceBillTypeField == "3710") {
         //                                this.HMainSourceBillType = '生产订单'
         //                                this.hform.HMainSourceBillType = 3710
         //                                this.showHMainSourceBillType = false
         //                            } else if (data.hSourceBillTypeField == "3711") {
         //                                this.HMainSourceBillType = '生产汇报单'
         //                                this.hform.HMainSourceBillType = 3711
         //                                this.showHMainSourceBillType = false
         //                            } else if (data.hSourceBillTypeField == "3714") {
         //                                this.HMainSourceBillType = '工序汇报单'
         //                                this.hform.HMainSourceBillType = 3714
         //                                this.showHMainSourceBillType = false
         //                            } else {
         //                                this.HMainSourceBillType = '手工录入'
         //                                this.hform.HMainSourceBillType = -1
         //                                this.showHMainSourceBillType = false
         //                            }
                                    if (data.hMulSourceFlagField == 0) {
                                        this.showHSourceBillNo = false
                                    }
@@ -1206,22 +1274,31 @@
                            this.hform.HBillNo = data.HBillNo
                            this.hform.HMainSourceBillType = data.HSourceBillType
                            this.hform.HSourceBillNo = data.HSourceBillNo
                            if (data.HSourceBillType == 3710) {
                                this.hform.HMainSourceBillType = 3710
                                this.HMainSourceBillType = '生产订单'
                                this.showHSupName = false
                            } else if (data.HSourceBillType == 3711) {
                                this.hform.HMainSourceBillType = 3711
                                this.HMainSourceBillType = '生产汇报单'
                                this.showHSupName = false
                            } else if (data.HSourceBillType == 3714) {
                                this.hform.HMainSourceBillType = 3714
                                this.HMainSourceBillType = '工序汇报单'
                                this.showHSupName = false
                            } else {
                                this.hform.HMainSourceBillType = -1
                                this.HMainSourceBillType = '手工录入'
                            }
                     let index = this.arrayHMainSourceBillValue.findIndex(e => e = data.HSourceBillType)
                     if (index != -1) {
                        this.HMainSourceBillType = this.arrayHMainSourceBillType[index]
                        this.hform.HMainSourceBillType = data.HSourceBillType
                        if (this.HMainSourceBillType != -1) {
                           this.showHSupName = false
                        }
                     }
                            // if (data.HSourceBillType == 3710) {
                            //     this.hform.HMainSourceBillType = 3710
                            //     this.HMainSourceBillType = '生产订单'
                            //     this.showHSupName = false
                            // } else if (data.HSourceBillType == 3711) {
                            //     this.hform.HMainSourceBillType = 3711
                            //     this.HMainSourceBillType = '生产汇报单'
                            //     this.showHSupName = false
                            // } else if (data.HSourceBillType == 3714) {
                            //     this.hform.HMainSourceBillType = 3714
                            //     this.HMainSourceBillType = '工序汇报单'
                            //     this.showHSupName = false
                            // } else {
                            //     this.hform.HMainSourceBillType = -1
                            //     this.HMainSourceBillType = '手工录入'
                            // }
                            this.showHMainSourceBillType = false
                            //非多源单模式