chenhaozhe
2026-01-28 358377336e3e64e088d05bf67bd952bf4f25f419
src/views/logistics/transportGPS/Add_Edit_WL_YayBill.vue
@@ -435,8 +435,8 @@
                            <el-table-column align="center" label="器具代码" width="120">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.HMouldNumber" placeholder="请输入器具代码"
                                        @keyup.native.f7="openDataDialog(8, scope.row)"
                                        @dblclick.native="openDataDialog(8, scope.row)" />
                                        @keyup.native.f7="openDataDialog(17, scope.row)"
                                        @dblclick.native="openDataDialog(17, scope.row)" />
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="器具名称" width="120">
@@ -470,10 +470,7 @@
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="包装容器数量" width="120">
                                <template slot-scope="scope">
                                    <el-input-number v-model="scope.row.HMouldQty" :min="0" style="width: 90px;"
                                        controls-position="right"></el-input-number>
                                </template>
                                <template slot-scope="scope">{{ scope.row.HMouldQty }}</template>
                            </el-table-column>
                            <el-table-column align="center" label="物料数量" width="120">
                                <template slot-scope="scope">
@@ -516,13 +513,16 @@
                    :propsHOrgID="form.HOrgID" v-if="xsSeOutStockBillShow" />
                <GyCustomer @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyCustomerShow" />
                <GySupplier @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gySupplierShow" />
                <GyCartype @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" :volume="form.HCarTypeMaxVolume" v-if="gyCartypeShow" />
                <GyCartype @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName"
                    :volume="form.HCarTypeMaxVolume" v-if="gyCartypeShow" />
                <GyCar @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyCarShow" />
                <GyDriver @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyDriverShow" />
                <ContractTransport @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName"
                    v-if="ContractTransportShow" />
                <GyMould @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyMouldShow" />
                <AreaDialog @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" :HBeginAddrName="form.HBeginAddrName" :HEndAddrName="form.HEndAddrName"  v-if="AreaDialogShow" />
                <GyMaterialPackingRelation @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName"
                    :propHMaterID="editData[zbIndex].HMaterID" :propHOrgID="form.HOrgID"
                    v-if="gyMaterialPackingRelationShow" />
                <AreaDialog @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="AreaDialogShow" />
                <div slot="footer" class="dialog-footer">
                    <el-button type="primary" @click="deptClickSub">确 定</el-button>
                    <el-button @click="deptClose">取 消</el-button>
@@ -550,11 +550,11 @@
import GyCar from "@/views/basic/gyCar/gyCarList.vue"
import GyDriver from "@/views/system/user/GyDriver.vue"
import ContractTransport from "@/views/basic/gytransport/cgContractTransportBillList/Cg_ContractTransportBillList.vue"
import GyMould from '@/views/scMould/basicModeling/Gy_MouldFileList.vue'
import GyMaterialPackingRelation from '@/views/scMould/basicModeling/Gy_MaterialPackingRelationList.vue'
import AreaDialog from "@/views/component/AreaDialog"
export default {
    name: 'SellOutBill',
    components: { Dept, Warehouse, Material, RowSettings, XsSeOutStockBill, GyCustomer, GySupplier, GyCartype, GyCar, GyDriver, ContractTransport, GyMould, AreaDialog },
    name: 'Add_Edit_WL_YayBill.vue',
    components: { Dept, Warehouse, Material, RowSettings, XsSeOutStockBill, GyCustomer, GySupplier, GyCartype, GyCar, GyDriver, ContractTransport, GyMaterialPackingRelation, AreaDialog },
    props: {
        OperationType: { type: Number, },
        linterid: { type: Number, },
@@ -595,7 +595,7 @@
            gyCarShow: false,                                                          //车辆数据组件显示标记
            gyDriverShow: false,                                                       //司机数据组件显示标记
            ContractTransportShow: false,                                              //承运合同数据组件显示标记
            gyMouldShow: false,                                                       //容器数据组件显示标记
            gyMaterialPackingRelationShow: false,                                                       //容器数据组件显示标记
            AreaDialogShow: false,                                                    //目的地数据组件显示标记
            deptform: {},                                                              //弹窗选中数据
            areaType: '',//地区选择类型
@@ -684,117 +684,6 @@
            }
            else if (this.OperationType == 3 || this.copyType == 1) {
                this.handleUpdate()
            }
            else if (this.OperationType == 4) {
                this.zzSelDis = true
                this.handleAdd()
                var data = this.getUrlVars_JSON();
                var dataArray = [];
                for (var i = 0; i < data.length; i++) {
                    // this.getPushSourceBillInit(data[i].hmainid, data[i].hsubid);
                    axios.get(this.$baseUrl + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
                        params: {
                            "HInterID": data[i].hmainid
                            , "HSubID": data[i].hsubid
                        },
                    }).then(response => {
                        let result = response.data
                        if (result.code == 1) { // 说明验证成功了,
                            this.temp = result.data[0];
                        } else {
                            this.temp = result.data;
                        }
                        if (this.temp) {
                            dataArray.push(this.temp);
                            this.form.HDeptID = dataArray[0].HDeptID
                            this.form.HDeptName = dataArray[0].部门
                            this.form.HEmpID = dataArray[0].HEmpID
                            this.form.HEmpName = dataArray[0].业务员
                            this.form.HManagerID = dataArray[0].HManagerID
                            this.form.HManagerName = dataArray[0].主管
                            this.form.HMainSourceInterID = "0"
                            this.form.HMainSourceEntryID = "0"
                            this.form.HMainSourceBillNo = ""
                            this.form.HMainSourceBillType = dataArray[0].HBillType
                            this.form.HSupID = dataArray[0].HCusID
                            this.form.HSupName = dataArray[0].客户
                            this.form.HLinkMan = dataArray[0].联系人
                            this.form.HLinkPhone = dataArray[0].联系电话
                            this.form.HSellSID = dataArray[0].HSellSID
                            this.form.HSellSName = dataArray[0].销售方式
                            this.form.HCurID = dataArray[0].HCurID
                            this.form.HCurName = dataArray[0].币别
                            this.form.HExRate = dataArray[0].汇率
                            for (var i = 0; i < dataArray.length; i++) {
                                this.editData.push(
                                    {
                                        "HMaterID": dataArray[i].HMaterID
                                        , "物料代码": dataArray[i].物料代码
                                        , "物料名称": dataArray[i].物料名称
                                        , "规格型号": dataArray[i].规格型号
                                        , "HUnitID": dataArray[i].HUnitID
                                        , "计量单位": dataArray[i].计量单位
                                        , "HQtyMust": dataArray[i].数量.toFixed(6)
                                        , "HQty": dataArray[i].数量.toFixed(6)
                                        , "HPieceQty": "0"
                                        , "HPrice": dataArray[i].单价.toFixed(4)
                                        , "HTaxPrice": dataArray[i].实际含税单价.toFixed(4)
                                        , "HTaxRate": dataArray[i].税率
                                        , "HMoney": dataArray[i].金额.toFixed(2)
                                        , "HTaxMoney": dataArray[i].价税合计.toFixed(2)
                                        , "HWHID": dataArray[i].HWHID
                                        , "发货仓库": dataArray[i].HWHName
                                        , "HRemark": ""
                                        , "HQty_Full": "0"
                                        , "HQty_Empty": "0"
                                        , "HQty_Back": "0"
                                        , "HCostPrice": "0"
                                        , "HCostMoney": "0"
                                        , "HSalePrice": "0"
                                        , "HSeOrderInterID": dataArray[i].hmainid
                                        , "HSeOrderEntryID": dataArray[i].hsubid
                                        , "HSeOrderBillNo": dataArray[i].单据号
                                        , "HSourceInterID": dataArray[i].hmainid
                                        , "HSourceEntryID": dataArray[i].hsubid
                                        , "HSourceBillNo": dataArray[i].单据号
                                        , "HSourceBillType": dataArray[i].HBillType
                                        , "HRelationQty": "0"
                                        , "HRelationMoney": "0"
                                        , 'HSPID': "0"
                                        , 'HSPName': ""
                                        , 'HSPGroupID': "0"
                                        , "HSPGroupName": ""
                                        , 'HSCWHID': "0"
                                        , 'HSCWHName': ""
                                        , 'HSCSPID': "0"
                                        , 'HSCSPName': ""
                                        , 'HBatchNo': ""
                                        , 'HPOOrderInterID': "0"
                                        , 'HPOOrderEntryID': "0"
                                        , 'HPOOrderBillNo': ""
                                        , 'HPropertyID': "0"
                                        , 'HPropertyName': ""
                                        , 'HSecUnitID': "0"
                                        , 'HSecUnitName': ""
                                        , 'HSecUnitRate': "0"
                                        , 'HEngineNum': ""
                                        , 'HUnderPanNum': ""
                                        , 'HLeaveFactCard': ""
                                        , 'HReqBuyQty': "0"
                                        , 'HReqOutQty': "0"
                                        , 'HCurrentInventory': "0"
                                    }
                                );
                            }
                        }
                        this.$nextTick(() => {
                            this.formShow = true
                            this.formLoading = false
                        })
                    }).catch(error => {
                        this.$modal.msgError("接口请求失败!");
                    });
                }
            }
        },
        //#endregion
@@ -890,13 +779,12 @@
            })
        },
        //#endregion
        //#region 编辑页面初始化
        handleUpdate() {
            this.reset()
            let rowHmainid = this.linterid
            axios.get(this.$baseUrl + "/Kf_POStockInBill/cx", {
                params: { 'HInterID': rowHmainid }
            axios.get(this.baseURL + "/WLYayBillController/WL_YayBillDetail", {
                params: { 'HID': rowHmainid }
            }).then(response => {
                console.log(response.data.data.h_v_WL_YayBillEdit)
                if (response.data.code == 1) {
@@ -1075,10 +963,6 @@
                this.dialogTitle = '客户列表'
                this.gyCustomerShow = true
                this.openData = true
            } else if (num == 8) {
                this.dialogTitle = '容器列表'
                this.gyMouldShow = true
                this.openData = true
            } else if (num == 12) {
                this.dialogTitle = '源单列表'
                this.xsSeOutStockBillShow = true
@@ -1092,12 +976,16 @@
                this.gyCarShow = true
                this.openData = true
            } else if (num == 15) {
                this.dialogTitle = '车辆列表'
                this.dialogTitle = '司机列表'
                this.gyDriverShow = true
                this.openData = true
            } else if (num == 16) {
                this.dialogTitle = '承运合同列表'
                this.ContractTransportShow = true
                this.openData = true
            } else if (num == 17) {
                this.dialogTitle = '容器包装列表'
                this.gyMaterialPackingRelationShow = true
                this.openData = true
            }
        },
@@ -1113,7 +1001,7 @@
            this.gyCarShow = false
            this.gyDriverShow = false
            this.ContractTransportShow = false
            this.gyMouldShow = false
            this.gyMaterialPackingRelationShow = false
        },
        //#endregion
        //#endregion
@@ -1154,16 +1042,6 @@
                this.form.HCusID = deptRow.HItemID
                this.gyCustomerShow = false
                this.openData = false
            } else if (num == 8) {
                console.log(deptRow)
                this.editData[this.zbIndex].HMouldID = deptRow.hmainid
                this.editData[this.zbIndex].HMouldNumber = deptRow.模具编号
                this.editData[this.zbIndex].HMouldName = deptRow.模具名称
                this.editData[this.zbIndex].HMouldLength = deptRow.长
                this.editData[this.zbIndex].HMouldWidth = deptRow.宽
                this.editData[this.zbIndex].HMouldFoldHeight = deptRow.折叠高度
                this.gyMouldShow = false
                this.openData = false
            } else if (num == 12) {
                // 使用异步方式处理源单数据
                this.processSourceDataAsync(deptRow);
@@ -1200,6 +1078,24 @@
                this.form.HCarrierID = deptRow.HSupID
                this.form.HCarrierName = deptRow.供应商名称
                this.ContractTransportShow = false
                this.openData = false
            } else if (num == 17) {
                console.log(deptRow)
                this.editData[this.zbIndex].HMouldID = deptRow.hmainid
                this.editData[this.zbIndex].HMouldNumber = deptRow.容器代码
                this.editData[this.zbIndex].HMouldName = deptRow.容器名称
                this.editData[this.zbIndex].HMouldLength = deptRow.长度
                this.editData[this.zbIndex].HMouldWidth = deptRow.宽度
                this.editData[this.zbIndex].HMouldHeight = deptRow.高度
                this.editData[this.zbIndex].HMouldFoldHeight = deptRow.折叠高度
                this.editData[this.zbIndex].HSNP = deptRow.容器包装产品数量
                this.editData[this.zbIndex].HVolume = (this.editData[this.zbIndex].HMouldLength * this.editData[this.zbIndex].HMouldWidth * this.editData[this.zbIndex].HMouldHeight).toFixed(2) - 0
                this.form.HTotalVolume = 0
                this.editData.map(item => {
                    this.form.HTotalVolume = item.HVolume + this.form.HTotalVolume
                })
                this.editData[this.zbIndex].HMouldQty = Math.ceil(this.editData[this.zbIndex].HQty / this.editData[this.zbIndex].HSNP)
                this.gyMaterialPackingRelationShow = false
                this.openData = false
            }
        },
@@ -1359,7 +1255,7 @@
                    return;
                }
                const response = await axios.get(this.$baseUrl + '/WLYayBillController/GetMesByOrginBill', {
                const response = await axios.get(this.baseURL + '/WLYayBillController/GetMesByOrginBill', {
                    params: {
                        "ListMaterial": ListMaterial
                    },
@@ -1467,7 +1363,7 @@
        //改为异步方法,返回Promise
        async getPushSeOutStockBillInit(HSourceInterID, HSourceEntryID) {
            try {
                const response = await axios.get(this.$baseUrl + '/Kf_SellOutBill/loadXs_SeOutStockBill_Push', {
                const response = await axios.get(this.baseURL + '/Kf_SellOutBill/loadXs_SeOutStockBill_Push', {
                    params: {
                        "HInterID": HSourceInterID,
                        "HSubID": HSourceEntryID
@@ -1491,40 +1387,35 @@
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    let fhck = false
                    this.editData.map((item, index) => {
                        if (!item.发货仓库) {
                            fhck = true
                            this.$modal.msgError("第" + (index + 1) + "行:发货仓库未选择!");
                    var loadingRate = this.form.HLoadingRate;
                    if (loadingRate && typeof loadingRate === 'string') {
                        this.form.HLoadingRate = parseFloat(loadingRate.replace('%', '')) / 100;
                    }
                    var sMainStr = JSON.stringify(this.form);
                    var sSubStr = JSON.stringify(this.editData);
                    console.log(this.form)
                    // var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"] + ';' + this.OperationType;
                    var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"]
                    console.log(sMainSub)
                    axios({
                        method: 'post',
                        url: this.baseURL + "/WLYayBillController/SaveBill",
                        data: {
                            'msg': sMainSub
                        },
                    }).then(response => {
                        if (response.data.count == 1) {
                            this.subDisabled = true//设置保存按钮不可用
                            this.$modal.msgSuccess(response.data.Message);
                            this.close()
                        } else {
                            this.$modal.msgError(response.data.Message)
                        }
                    })
                    this.$nextTick(() => {
                        if (!fhck) {
                            var sMainStr = JSON.stringify(this.form);
                            var sSubStr = JSON.stringify(this.editData);
                            var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"] + ';' + this.OperationType;
                            axios({
                                method: 'post',
                                url: this.$baseUrl + "/Kf_SellOutBill/SaveSellOutBillList",
                                data: {
                                    'msg': sMainSub
                                },
                            }).then(response => {
                                if (response.data.count == 1) {
                                    this.subDisabled = true//设置保存按钮不可用
                                    this.$modal.msgSuccess(response.data.Message);
                                    this.get_MAXNum_Task(1);//设置流水号增加
                                    if (response.data.Verify == "Y") //自动审核
                                    {
                                        this.set_CheckBill(0, this.form); //审核
                                    }
                                    this.addBtnShow = true
                                }
                            }).catch(error => {
                                this.$modal.msgError("接口请求失败!");
                            });
                        }
                    })
                    }).catch(error => {
                        this.$modal.msgError("接口请求失败!");
                    });
                }
            });
        },
@@ -1534,7 +1425,7 @@
        set_CheckBill(num, form) {
            var InterID = form.hmainid || form.HInterID
            //逻辑审核方法
            axios.get(this.$baseUrl + "/Kf_SellOutBill/AuditKf_SellOutBill", {
            axios.get(this.baseURL + "/Kf_SellOutBill/AuditKf_SellOutBill", {
                params: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"] }
            }).then(response => {
                let result = response.data
@@ -1655,22 +1546,9 @@
        },
        //#endregion
        //#region 组织下拉列表数据初始化
        fetchData() {
            axios.get(this.$baseUrl + "/Web/GetOrganizations", {
            }).then(response => {
                if (response.data.count == 1) {
                    this.organizationList = response.data.data;//组织列表
                }
            }).catch(error => {
                this.$modal.msgError("接口请求失败!");
            });
        },
        //#endregion
        //#region 获取内码、单据号
        getHBillNo() {
            axios.get(this.$baseUrl + "/WEBSController/GetMaxBillNoAndID_Json", {
            axios.get(this.baseURL + "/Web/GetMAXNum", {
                params: {
                    HBillType: '3321'
                }
@@ -1687,7 +1565,7 @@
            var sql = `exec h_p_Xt_GetMaxBillNo_SubType '1201','${this.form.HDate}',0,0,0,'${Type}','${this.form.HDeptID}'`;
            axios({
                method: 'get',
                url: this.$baseUrl + "/CommonModel/searchMethod",
                url: this.baseURL + "/CommonModel/searchMethod",
                params: { "sql": sql, "user": sessionStorage["HUserName"], "ModRightNameCheck": "" },
            }).then(response => {
                if (response.data.count == 1) {
@@ -1703,7 +1581,7 @@
        //#region 根据用户获取对应职员、部门、销售主管
        getCzyglByUser() {
            axios.get(this.$baseUrl + '/Xs_SeOrderBill/getCzyglByUser', {
            axios.get(this.baseURL + '/Xs_SeOrderBill/getCzyglByUser', {
                params: { "CurUserName": sessionStorage["HUserName"] }
            }).then(response => {
                let dataForm = response.data.data[0]
@@ -1721,7 +1599,7 @@
        //#region 根据客户获取客户余额
        getCustomerBalance(HCusID) {
            axios.get(this.$baseUrl + '/Xs_CusRatingChangeBill/getCustomerBalance', {
            axios.get(this.baseURL + '/Xs_CusRatingChangeBill/getCustomerBalance', {
                params: { "HCusID": HCusID, 'CurUserName': sessionStorage["HUserName"] }
            }).then(response => {
                var data = response.data.data[0];
@@ -1736,7 +1614,7 @@
        //#region 根据客户带出联系人、联系电话
        getCustomerByCusID(HCusID) {
            axios.get(this.$baseUrl + "/Xs_SeOrderBill/getCustomerByCusID", {
            axios.get(this.baseURL + "/Xs_SeOrderBill/getCustomerByCusID", {
                params: {
                    HCusID: HCusID
                }
@@ -1753,7 +1631,7 @@
        //#region 获取销售出库单对应的条码明细
        getBarCodeNoteBySellOutBill(rowHmainid) {
            axios.get(this.$baseUrl + '/Kf_SellOutBill/BarCodeNote', {
            axios.get(this.baseURL + '/Kf_SellOutBill/BarCodeNote', {
                params: { "HInterID": rowHmainid }
            }).then(response => {
                if (response.data.count == 1) {
@@ -1770,7 +1648,7 @@
        //#region 根据主内码与子内码获取源单销售订单数据
        getPushSourceBillInit(HSourceInterID, HSourceEntryID) {
            axios.get(this.$baseUrl + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
            axios.get(this.baseURL + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
                params: {
                    "HInterID": HSourceInterID
                    , "HSubID": HSourceEntryID
@@ -1801,7 +1679,6 @@
        //#endregion
        checkTotalQtyExceed(selRow) {
            var tableData = this.editData
            console.log(tableData)
            if (!tableData || tableData.length === 0) return;
            var sourceQtyMap = {};
            var currentQtyMap = {};
@@ -1850,8 +1727,6 @@
                    });
                }
            }
            console.log(exceedSources)
            if (exceedSources.length > 0) {
                var message = '物料数量之和超过源单数量:';
                exceedSources.forEach(function (item, index) {
@@ -1863,7 +1738,7 @@
                this.$modal.msgError(message);
                return true; // 表示有超出
            }
            this.editData[selRow.index-1].HMouldQty = Math.ceil(selRow.HQty / this.editData[selRow.index-1].HSNP)
            return false; // 表示没有超出
        },
        //#region 附件上传相关方法
@@ -1900,7 +1775,7 @@
            formData.append('HRemark', '');
            formData.append('HUserName', sessionStorage["HUserName"]);
            // 设置上传URL
            this.uploadUrl = this.$baseUrl + '/Gy_QCVerificationBillMain/UploadFile_Gy_QCVerification';
            this.uploadUrl = this.baseURL + '/Gy_QCVerificationBillMain/UploadFile_Gy_QCVerification';
            // 发送上传请求
            axios.post(this.uploadUrl, formData, {
                headers: {
@@ -1948,7 +1823,7 @@
            formData.append('HUserName', sessionStorage.getItem('HUserName') || '');
            // 设置上传URL
            this.uploadUrl = this.$baseUrl + '/Gy_QCVerificationBillMain/UploadFile_Gy_QCVerification';
            this.uploadUrl = this.baseURL + '/Gy_QCVerificationBillMain/UploadFile_Gy_QCVerification';
            // 发送上传请求
            axios.post(this.uploadUrl, formData, {