wangyi
2025-11-27 86d627eecb14597a338ee402eab5a0c05ce1bdeb
src/views/warehouse/barcodeMaster/Gy_BarCodeBill.vue
@@ -1,21 +1,20 @@
<template>
    <div v-loading="formLoading" v-if="formShow" style="margin: 10px;">
        <div style=" margin-bottom: 10px; border-bottom: 1px solid #f6f6f6;">
            <el-button type="primary">预览打印</el-button>
            <el-button type="primary">生成</el-button>
            <el-button type="primary">重置</el-button>
            <el-button type="primary" @click="get_PrintReport">预览打印</el-button>
            <el-button type="primary" @click="ToolCreate" :disabled="disabledToolCreate">生成</el-button>
            <!-- <el-button type="primary">重置</el-button>
            <el-button type="primary">库存</el-button>
            <el-button type="primary">同步资料</el-button>
            <el-button type="primary">批次</el-button>
            <el-button type="primary">同步资料</el-button> -->
            <el-button type="primary" @click="ToolBatch">批次</el-button>
            <el-button type="primary" @click="close">退 出</el-button>
        </div>
        <div style="margin: 10px; font-size: 28px; font-weight: bold; text-align: center;">器具档案编辑</div>
        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
            <el-row>
                <el-col :span="6">
                    <el-form-item label="组织" prop="HOrgID">
                        <el-select v-model="form.HOrgID" placeholder="请选择组织" @change="organizationChange"
                            style="width: 100%">
                    <el-form-item label="组织" prop="HOrgID" @change="HOrgIDChange">
                        <el-select v-model="form.HOrgID" placeholder="请选择组织" style="width: 100%">
                            <el-option v-for="(item, index) in organizationList" :key="index" :label="item.Name"
                                :value="item.ID">
                            </el-option>
@@ -41,7 +40,8 @@
            <el-row>
                <el-col :span="6">
                    <el-form-item label="源单类型" prop="HSourceBillType">
                        <el-select v-model="form.HSourceBillType" placeholder="请选择" style="width: 100%">
                        <el-select v-model="form.HSourceBillType" placeholder="请选择" style="width: 100%"
                            @change="HSourceBillTypeChange">
                            <el-option v-for="(item, index) in HSourceBillTypeList" :key="index" :label="item.label"
                                :value="item.value">
                            </el-option>
@@ -51,7 +51,7 @@
                <el-col :span="6">
                    <el-form-item label="选单号" prop="HSourceBillNo">
                        <el-input v-model="form.HSourceBillNo" placeholder="请输入选单号" disabled>
                            <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                            <el-button slot="append" icon="el-icon-search" @click="openDataDialog(openNum)"></el-button>
                        </el-input>
                    </el-form-item>
                </el-col>
@@ -65,8 +65,8 @@
                    </el-form-item>
                </el-col>
            </el-row>
            <el-tabs type="border-card">
                <el-tab-pane label="物料信息">
            <el-tabs type="border-card" v-model="barcodeName">
                <el-tab-pane label="物料信息" name="wuliao">
                    <div style="margin-bottom: 10px;">
                        <el-button type="success" plain icon="el-icon-plus" @click="handleAddSysZb()"
                            size="mini">增加一行</el-button>
@@ -76,25 +76,145 @@
                    <el-table :data="editWlxxData" style="width: 100%" height="480" width="100%" ref="wlxxzbTable"
                        @selection-change="handleTableWlxxZbEdit" :row-class-name="wlxxzbRowSysZbIndex" border>
                        <el-table-column type="selection" width="55" align="center" />
                        <el-table-column align="center" label="序号" type="index" width="80" fixed />
                        <template v-for="(item, index) in wlxxBtList">
                            <el-table-column align="center" :prop="item.field" :label="item.title" :width="item.width"
                                :key="index" show-overflow-tooltip v-if="!item.hide">
                                <template slot-scope="{row,  column }">
                                    <div :style="item.style">
                                        <el-input v-if="item.edit == 'text'" v-model="row[column.label]" />
                                        <el-input-number v-else-if="item.edit == 'number'" v-model="row[column.label]"
                                            :min="0" controls-position="right" style="width: 100%;" />
                                        <el-date-picker v-else-if="item.edit == 'date'" v-model="row[column.label]"
                                            type="date" placeholder="选择日期" value-format="yyyy-MM-ddT"
                                            style="width: 100%"> </el-date-picker>
                                        <el-checkbox v-else-if="item.edit == 'checkbox'"
                                            v-model="row[column.label]"></el-checkbox>
                                        <span v-else>{{ row[column.label] }}</span>
                                    </div>
                        <el-table-column align="center" label="序号" type="index" width="80" fixed
                            show-overflow-tooltip />
                        <el-table-column align="center" label="源单单号" prop="HBillNo" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HBillNo }} </template>
                        </el-table-column>
                        <el-table-column align="center" label="物料代码" prop="HMaterNumber" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HMaterNumber" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="物料名称" prop="HMaterName" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HMaterName }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="规格型号" prop="HMaterModel" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HMaterModel }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="客户规格型号" prop="HCusModel" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HCusModel" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="客户物料名称" prop="HCusMaterName" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"> <el-input v-model="scope.row.HCusMaterName" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="操作员代码" prop="HEmpNumber" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"> <el-input v-model="scope.row.HEmpNumber" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="操作员" prop="HEmpName" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HEmpName }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="班组代码" prop="HGroupNumber" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HGroupNumber" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="班组名称" prop="HGroupName" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HGroupName }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="检验员" prop="HCheckEmpName" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HCheckEmpName" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="批号" prop="HBatchNo" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HBatchNo" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="计划跟踪号" prop="HMTONo" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HMTONo" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="数量" prop="HQty" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">
                                <el-input-number v-model="scope.row.HQty" :min="0" controls-position="right"
                                    style="width: 100%;" @change="editMainTable(scope.row)" />
                                </template>
                            </el-table-column>
                        <el-table-column align="center" label="最小包装数" prop="HMinQty" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">
                                <el-input-number v-model="scope.row.HMinQty" :min="0" controls-position="right"
                                    style="width: 100%;" @change="editMainTable(scope.row)" />
                        </template>
                        </el-table-column>
                        <el-table-column align="center" label="箱数" prop="HBQty" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HBQty }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="外箱数" prop="HPackQty" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HPackQty" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="钢卷捆包号" prop="HCoilNO" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HCoilNO" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="炉号" prop="HFurnaceNO" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HFurnaceNO" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="厂商" prop="HFactory" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HFactory" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="客户代码" prop="HCusNumber" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HCusNumber" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="客户名称" prop="HCusName" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HCusName }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="销售订单号" prop="HSeOrderBillNo" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HSeOrderBillNo }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="备注" prop="HRemark" width="120" show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HRemark }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="生产日期" prop="HProduceDate" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">
                                <el-date-picker v-model="scope.row.HProduceDate" type="date" placeholder="选择日期"
                                    value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                            </template>
                        </el-table-column>
                        <el-table-column align="center" label="保质期至" prop="HExpiryDate" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">
                                <el-date-picker v-model="scope.row.HExpiryDate" type="date" placeholder="选择日期"
                                    value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                            </template>
                        </el-table-column>
                        <el-table-column align="center" label="热处理" prop="HheatNO" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HheatNO" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="辅助属性代码" prop="HAuxPropNumber" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HAuxPropNumber" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="辅助属性名称" prop="HAuxPropName" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HAuxPropName }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="计量单位代码" prop="HUnitNumber" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HUnitNumber" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="计量单位名称" prop="HUnitName" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">{{ scope.row.HUnitName }}</template>
                        </el-table-column>
                        <el-table-column align="center" label="辅单位数量" prop="HAuxQty" width="120" show-overflow-tooltip>
                            <template slot-scope="scope"><el-input v-model="scope.row.HAuxQty" /></template>
                        </el-table-column>
                        <el-table-column align="center" label="是否启用保质期" prop="HExpirationDateFlag" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">
                                <el-checkbox v-model="scope.row.HExpirationDateFlag"></el-checkbox>
                            </template>
                        </el-table-column>
                        <el-table-column align="center" label="是否赠品" prop="HGiveAwayFlag" width="120"
                            show-overflow-tooltip>
                            <template slot-scope="scope">
                                <el-checkbox v-model="scope.row.HGiveAwayFlag"></el-checkbox>
                            </template>
                        </el-table-column>
                        <el-table-column align="center" label="操作" width="55" fixed="right">
                            <template slot-scope="scope">
                                <el-button type="danger" icon="el-icon-delete" size="mini" circle
@@ -103,117 +223,95 @@
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane label="条码信息">
                <el-tab-pane label="条码信息" name="tiaoma">
                    <el-table :data="editTmData" style="width: 100%" height="480" width="100%" ref="tbzbTable"
                        @selection-change="handleTableWlxxZbEdit" :row-class-name="wlxxzbRowSysZbIndex" border>
                        <el-table-column type="selection" width="55" align="center" />
                        @selection-change="handleTableWlxxZbEdit" :row-class-name="tiaomaZbIndex" border>
                        <el-table-column align="center" label="序号" type="index" width="80" fixed />
                        <template v-for="(item, index) in tmBtList">
                            <el-table-column align="center" :prop="item.field" :label="item.title" :width="item.width"
                                :key="index" show-overflow-tooltip v-if="!item.hide">
                                <template slot-scope="{row,  column }">
                                    <div :style="item.style">
                                        <el-input v-if="item.edit == 'text'" v-model="row[column.label]" />
                                        <el-input-number v-else-if="item.edit == 'number'" v-model="row[column.label]"
                                            :min="0" controls-position="right" style="width: 100%;" />
                                        <el-date-picker v-else-if="item.edit == 'date'" v-model="row[column.label]"
                                            type="date" placeholder="选择日期" value-format="yyyy-MM-ddT"
                                            style="width: 100%"> </el-date-picker>
                                        <el-checkbox v-else-if="item.edit == 'checkbox'"
                                            v-model="row[column.label]"></el-checkbox>
                                        <span v-else>{{ row[column.label] }}</span>
                                    </div>
                                :key="index" show-overflow-tooltip v-if="!item.hide" />
                                </template>
                            </el-table-column>
                        </template>
                        <el-table-column align="center" label="操作" width="55" fixed="right">
                            <template slot-scope="scope">
                                <el-button type="danger" icon="el-icon-delete" size="mini" circle
                                    @click="handleDeleteSysZb(scope.row)"></el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane label="档案列表"><el-table :data="editDaData" style="width: 100%" height="480" width="100%"
                        ref="dazbTable" @selection-change="handleTableWlxxZbEdit" :row-class-name="wlxxzbRowSysZbIndex"
                        border>
                <el-tab-pane label="档案列表" name="dangan">
                    <el-table :data="editDaData" style="width: 100%" height="480" width="100%" ref="dazbTable"
                        @selection-change="handleTableDangan" :row-class-name="danganZbIndex" border>
                        <el-table-column type="selection" width="55" align="center" />
                        <el-table-column align="center" label="序号" type="index" width="80" fixed />
                        <template v-for="(item, index) in daBtList">
                            <el-table-column align="center" :prop="item.field" :label="item.title" :width="item.width"
                                :key="index" show-overflow-tooltip v-if="!item.hide">
                                <template slot-scope="{row,  column }">
                                    <div :style="item.style">
                                        <el-input v-if="item.edit == 'text'" v-model="row[column.label]" />
                                        <el-input-number v-else-if="item.edit == 'number'" v-model="row[column.label]"
                                            :min="0" controls-position="right" style="width: 100%;" />
                                        <el-date-picker v-else-if="item.edit == 'date'" v-model="row[column.label]"
                                            type="date" placeholder="选择日期" value-format="yyyy-MM-ddT"
                                            style="width: 100%"> </el-date-picker>
                                        <el-checkbox v-else-if="item.edit == 'checkbox'"
                                            v-model="row[column.label]"></el-checkbox>
                                        <span v-else>{{ row[column.label] }}</span>
                                    </div>
                                    <div :style="item.style"><span>{{ row[column.label] }}</span> </div>
                                </template>
                            </el-table-column>
                        </template>
                        <el-table-column align="center" label="操作" width="55" fixed="right">
                            <template slot-scope="scope">
                                <el-button type="danger" icon="el-icon-delete" size="mini" circle
                                    @click="handleDeleteSysZb(scope.row)"></el-button>
                            </template>
                        </el-table-column>
                    </el-table></el-tab-pane>
                    </el-table>
                </el-tab-pane>
            </el-tabs>
        </el-form>
        <!-- 部门弹窗 -->
        <el-dialog :title="dialogTitle" :visible.sync="openData" width="1280px" append-to-body>
            <Dept @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="deptShow" />
            <Warehouse @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="warehouseShow" />
            <Material @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="materialShow" />
            <GyEmployee @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyEmployeeShow" />
            <HSourceReportHtml @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName"
                :HOrgID='this.form.HOrgID' :HSouceBillType="HSouceBillType" v-if="ScICMOBillShow" />
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="deptClickSub">确 定</el-button>
                <el-button @click="deptClose">取 消</el-button>
            </div>
        </el-dialog>
        <el-dialog title="打印模板选择" :visible.sync="openPrintList" width="800px" append-to-body>
            <PrintList :linterid="rowSel.toString()" :MyMsg="rowSel.toString()" Type="HGy_BarCodeBill"
                HModName="HGy_BarCodeBill" @rowEditClose="rowSetClose" v-if="printListShow" />
            <!-- <div>111</div> -->
        </el-dialog>
    </div>
</template>
<script>
import axios from 'axios'
import Dept from '@/views/component/dept'
import Warehouse from '@/views/component/warehouse'
import Material from '@/views/component/material'
import RowSettings from '@/views/component/rowSettings'
import GyEmployee from '@/views/basic/gyEmployee/gyEmployee.vue'
import HSourceReportHtml from '@/views/component/HSourceReportHtml'
import PrintList from "@/views/component/printList";
import moment from 'moment';
export default {
    name: 'Gy_BarCodeBill',
    components: { Dept, Warehouse, Material, RowSettings, GyEmployee },
    components: { HSourceReportHtml, PrintList },
    props: {
        OperationType: { type: Number, },
        linterid: { type: Number, },
        HSouceBillType: { type: String, },
        propsData: { type: String, },
        copyType: { type: Number, },
    },
    data() {
        return {
            rowSel:[],
            HModName: "Gy_BarCodeBill",
            danganSelList: [],
            openPrintList: false,
            printListShow: false,
            barcodeName: 'wuliao',
            HOrgSel: sessionStorage["Organization"],
            HMaterInfo: [],
            HSouceBillType: '生产订单',
            disabledToolCreate: false,
            HMinQty2: 0,
            BatchNoArray: [], //用来存储获取到的批号,在批次按钮功能中用到
            HMaterID: "",
            HBatchNo: "",
            openNum: 10,
            zbDataShow: true,
            HSourceBillTypeList: [
                { value: 1, label: '生产订单', },
                { value: 2, label: '生产汇报单', },
                { value: 3, label: '采购订单', },
                { value: 4, label: '收料通知单', },
                { value: 5, label: '委外订单', },
                { value: 6, label: '生产入库单', },
                { value: 7, label: '采购入库单', },
                { value: 8, label: '销售退货单', },
                { value: 9, label: '生产退料单', },
                { value: 10, label: '工序流转卡', },
                { value: 11, label: '销售出库单', },
                { value: 12, label: '领料出库单', }
                { value: '1', label: '生产订单', },
                { value: '2', label: '生产汇报单', },
                { value: '3', label: '采购订单', },
                { value: '4', label: '收料通知单', },
                { value: '5', label: '委外订单', },
                { value: '6', label: '生产入库单', },
                { value: '7', label: '采购入库单', },
                { value: '8', label: '销售退货单', },
                { value: '9', label: '生产退料单', },
                { value: '10', label: '工序流转卡', },
                { value: '11', label: '销售出库单', },
                { value: '12', label: '领料出库单', }
            ],
            wlxxBtList: [{ field: 'HMainID', title: '源单主内码', width: 100, hide: true }
                , { field: 'HSubID', title: '源单子内码', width: 100, hide: true }
@@ -350,6 +448,7 @@
            warehouseShow: false,//仓库数据组件
            materialShow: false,//物料数据组件
            gyEmployeeShow: false,//销售员数据组件
            ScICMOBillShow: false,
            deptform: {},//弹窗选中数据
            openData: false,//数据弹窗
            dialogTitle: '',
@@ -362,6 +461,8 @@
            editWlxxData: [],//子表
            editTmData: [],
            editDaData: [],
            HBarInfo: [],
            HFileList: [],
            editBtData: [],//子表表头
            activeName: 'first',
            // 弹出层标题
@@ -420,10 +521,166 @@
        this.getdata()
    },
    methods: {
        get_PrintReport() {
            if (this.danganSelList.length == 0) {
                this.$modal.msgError("请选择数据");
            } else {
                this.rowSel = [];
                for (var i = 0; i < this.danganSelList.length; i++) {
                     this.rowSel.push(this.danganSelList[i].HItemID.toString());
                }
                this.printListShow = true;
                this.openPrintList = true;
                // axios.get(this.baseURL + "/Kf_SellOutBill/CheckSellOutBill_IsExist", {
                //     params: { HInterID: this.rowForm.hmainid },
                // })
                //     .then((response) => {
                //         var result = response.data;
                //         if (result.count == 1) {
                //             this.printListShow = true;
                //             this.openPrintList = true;
                //         } else {
                //             this.$modal.msgError(result.code + result.Message);
                //         }
                //     })
                //     .catch((error) => {
                //         this.$modal.msgError("接口请求失败!");
                //     });
            }
        },
        HOrgIDChange(val) {
            this.organizationList.map(item => {
                if (item.ID == val) {
                    this.HOrgSel = item.Name
                }
            })
        },
        ToolBatch() {
            if (this.HMinQty2 == 0 && this.HMaterID) {
                axios.get(this.baseURL + '/Sc_BarCode/Batch', {
                    params: {
                        "HMaterID": this.HMaterID, "HBatchNo": this.HBatchNo
                    },
                }).then(response => {
                    let data1 = response.data
                    if (data1.count == 1) {
                        if (data1.code == 1) {
                            this.BatchNoArray[0].HBatchNo = data1.data
                            this.BatchNoArray[0].HMinQty = HMinQty2
                            console.log(this.BatchNoArray)
                            this.$modal.msgSuccess(data1.Message, sessionStorage["HTranSlate"])
                        }
                    } else {
                        this.$modal.msgError(data1.Message);
                    }
                }).catch(error => {
                    this.$modal.msgError("请您在获取批号后在输入最小包装数 ^_^");
                })
            } else {
                this.$modal.msgError(data1.Message);
            }
        },
        ToolCreate() {
            this.disabledToolCreate = true
            for (var i = 0; i < this.editWlxxData.length; i++) {
                this.editWlxxData[i].HDate = moment(this.form.HDate).format('YYYY-MM-DD');
                if (this.editWlxxData[i].HMaterName != null && (this.editWlxxData[i].HMaterName.indexOf("\"") != -1 || this.editWlxxData[i].HMaterName.indexOf(";") != -1)) {
                    this.editWlxxData[i].HMaterName = this.editWlxxData[i].HMaterName.replaceAll("\"", "”").replaceAll(";", ";")
                }
                if (this.editWlxxData[i].HMaterModel != null && (this.editWlxxData[i].HMaterModel.indexOf("\"") != -1 || this.editWlxxData[i].HMaterModel.indexOf(";") != -1)) {
                    this.editWlxxData[i].HMaterModel = this.editWlxxData[i].HMaterModel.replaceAll("\"", "”").replaceAll(";", ";")
                }
                if (this.editWlxxData[i].HPinfan != null && ("HPinfan" in this.editWlxxData[i])) {
                    if (this.editWlxxData[i].HPinfan.indexOf("\"") != -1 || this.editWlxxData[i].HPinfan.indexOf(";") != -1) {
                        this.editWlxxData[i].HPinfan = this.editWlxxData[i].HPinfan.replaceAll("\"", "”").replaceAll(";", ";")
                    }
                }
            }
            var sSubStr = JSON.stringify(this.editWlxxData);
            this.HMaterInfo = this.editWlxxData
            if (!this.AllowLoadData(sSubStr)) {//数据验证
                this.disabledToolCreate = false//生成按钮启用
                return false
            }
            //获取选择的组织
            var HOrgType = this.HOrgSel
            console.log(HOrgType)
            //获取选择的工厂代码
            var CampanyName = this.form.HWorksNumber
            if (CampanyName == "" || CampanyName == null) {
                CampanyName = "xxx";
            }
            //获取选择的源单类型
            var HSourceBillType = this.form.HSourceBillType
            //获取选择的条码类型
            var HSelectBarCodeType = this.form.HBarCodeType
            //获取当前登录人员
            var UserName = sessionStorage["HUserName"];
            //var UserName = "Admin";
            var sMainSub = sSubStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' + CampanyName + ';' + UserName;
            this.SaveBarCodeCreate(sMainSub);
        },
        AllowLoadData(sSubStr) {
            var Result = true;
            if (typeof (sSubStr) == "undefined" || sSubStr == "") {
                this.$modal.msgError("没有物料明细记录")
                return Result = false;
            }
            if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
                sSubStr = JSON.parse(sSubStr);
                sSubStr.map((item, index) => {
                    if (!item.HMaterID) {
                        this.$modal.msgError("明细记录第" + (index + 1) + "行,物料信息为空!")
                        return Result = false;
                    }
                    if (!item.HQty) {
                        this.$modal.msgError("明细记录第" + (index + 1) + "行,数量为空!")
                        return Result = false;
                    }
                })
            }
            else {
                return Result = true;
            }
            return Result;
        },
        SaveBarCodeCreate(sMainSub, CampanyName) {
            axios({
                method: 'post',
                url: this.baseURL + "/Sc_BarCode/Sub_SaveBill",
                data: {
                    "msg": sMainSub, "CampanyName": CampanyName
                },
            }).then(response => {
                let result = response.data
                if (result.count == 1) { // 说明验证成功了,
                    this.editTmData = result.list // 调用table.reload 重新渲染显示加载追加了数据的表格
                    this.HBarInfo = result.list;
                    //加载档案列表
                    this.editDaData = result.data
                    this.HFileList = result.data;
                    this.barcodeName = 'dangan'
                }
                else {
                    this.disabledToolCreate = false//生成按钮启用
                    this.$modal.msgError(result.Message, sessionStorage["HTranSlate"])
                }
            }).catch(error => {
                this.$modal.msgError("接口请求失败!");
            });
        },
        editMainTable(row) {
            row.HBQty = Math.ceil(row.HQty / row.HMinQty)
        },
        HSourceBillTypeChange(val) {
            if (val == 1) {
                this.openNum == 10
            }
        },
        set_HBarCodeType() {
            //获取条码类型代码
            axios.get(this.baseURL + '/Sc_BarCode/GetHBarCodeTypeBill').then(response => {
                console.log(response)
                let result = response.data
                if (result.count == 1) {
                    this.HBarCodeTypeList = result.list
@@ -432,7 +689,6 @@
                this.$modal.msgError("接口请求失败!");
            });
            axios.get(this.baseURL + '/Sc_BarCode/GetHWorksNumberBill').then(response => {
                console.log(response)
                let result = response.data
                if (result.count == 1) {
                    this.HWorksNumberList = result.list
@@ -443,124 +699,9 @@
        },
        getdata() {
            console.log(this.copyType, this.OperationType)
            this.formShow = false
            this.formLoading = true
            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.editWlxxData.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("接口请求失败!");
                    });
                }
            } else if ((this.OperationType == 1 && this.copyType != 1) || (!this.OperationType && !this.copyType)) {
                this.handleAdd()
            } else if (this.OperationType == 3 || this.copyType == 1) {
                this.handleUpdate()
            }
        },
        // 获取参数_传递的JSON格式参数
        getUrlVars_JSON() {
@@ -570,24 +711,6 @@
            datajson = JSON.parse(decodeURI(arr));
            return datajson;
        },
        //根据主内码与子内码获取源单销售订单数据
        getPushSourceBillInit(HSourceInterID, HSourceEntryID) {
            axios.get(this.baseURL + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
                params: {
                    "HInterID": HSourceInterID
                    , "HSubID": HSourceEntryID
                },
            }).then(response => {
                let result = response.data
                if (result.code == 1) { // 说明验证成功了,
                    this.temp = result.data[0];
                } else {
                    this.temp = result.data;
                }
            }).catch(error => {
                this.$modal.msgError("接口请求失败!");
            });
        },
        handleRowHide() {
            this.rowHideShow = true
            this.openRowHide = true
@@ -596,48 +719,119 @@
            this.rowHideShow = false
            this.openRowHide = val
        },
        organizationChange(val) {
            // let options=undefined
            //  this.form=this.organizationList.find(option => option.ID === val)?.Name || '';
        getSupType() {
            var type = this.form.HSourceBillType
            switch (type) {
                case '1':
                    return "生产订单";
                    break;
                case '2':
                    return "生产汇报单";
                    break;
                case '3':
                    return "采购订单";
                    break;
                case '4':
                    return "收料通知单";
                    break;
                case '5':
                    return "委外订单";
                    break;
                case '6':
                    return "生产入库单";
                    break;
                case '7':
                    return "采购入库单";
                    break;
                case '8':
                    return "销售退货单";
                    break;
                case '9':
                    return "生产退料单";
                    break;
                case '10':
                    return "工序流转卡";
                    break;
                case '11':
                    return '销售出库单';
                    break;
                case '12':
                    return '领料出库单';
                    break;
            }
        },
        //部门弹窗赋值
        isAllEqual(array) {
            return array.every(item => item === array[0])
        },
        //弹窗赋值
        dbEmitData(deptRow, num) {
            // num=1部门 num=2出库仓库
            console.log(deptRow)
            if (deptRow.HItemID) {
                if (num == 1) {
                    this.form.HDeptName = deptRow.部门名称
                    this.form.HDeptID = deptRow.HItemID
                    this.form.HManagerName = deptRow.负责人
                    this.deptShow = false
            if (deptRow.length > 0) {
                this.zbDataShow = false
                this.editWlxxData = []
                var list = []
                var BillSelect = []
                for (var i = 0; i < deptRow.length; i++) {
                    if (deptRow[i].部门 != "" && deptRow[i].部门 != null) {
                        list.push(deptRow[i].部门)
                    }
                    BillSelect.push({
                        BillType: deptRow[i].HBillType,
                        BillTitle: this.getSupType(),
                        BillNo: deptRow[i].单据号,
                        BillMainID: deptRow[i].HMainID,
                        BillSubID: deptRow[i].HSubID,
                        SPID: 0,
                        BatchNo: "",
                        HAuxPropID: 0
                    });
                }
                if (this.isAllEqual(list)) { //不允许选择不同部门
                    //获取选中数据
                    var GrdSelectData = JSON.stringify(BillSelect);
                    //获取选择的源单类型
                    var HSourceBillType = this.getSupType();
                    //获取选择的条码类型
                    var HBarCodeType = this.form.HBarCodeType;
                    //获取当前登录人员
                    var UserName = sessionStorage["HUserName"];
                    var Str = GrdSelectData + ";" + HSourceBillType + ";" + HBarCodeType + ";" + UserName;
                    //通过选择的源单主子内码查找详细信息
                    axios({
                        method: 'post',
                        url: this.baseURL + "/Sc_BarCode/SelectReportFromBillList",
                        data: {
                            "msg": Str
                        },
                    }).then(response => {
                        let result = response.data
                        this.HMaterID = result.list[0].HMaterID;
                        this.HBatchNo = result.list[0].HBatchNo;
                        if (result.count == 1) { // 说明验证成功了,
                            for (let i = 0; i < result.list.length; i++) {
                                result.list[i].HQty = result.list[i].HQty.toString().match(/^\d+(?:\.\d{0,6})?/)[0]  //保留小数点后六位小数
                                if (result.list[i].HMinQty != 0) {
                                    result.list[i].HBQty = Math.ceil(result.list[i].HQty / result.list[i].HMinQty)
                                }
                                result.list[i].HEmpID = sessionStorage["HEmpID"]
                                result.list[i].HEmpNumber = sessionStorage["HEmpNumber"]
                                result.list[i].HEmpName = sessionStorage["HEmpName"]
                            }
                            this.BatchNoArray = result.list;  //获取批号,用来给批次按钮功能中的批号赋值
                            this.editWlxxData = result.list
                            this.ScICMOBillShow = false
                            this.zbDataShow = true
                    this.openData = false
                } else if (num == 2) {
                    this.editData[this.zbIndex].HWHID = deptRow.HItemID;
                    this.editData[this.zbIndex].发货仓库 = deptRow.仓库名称;
                    this.warehouseShow = false
                    this.openData = false
                } else if (num == 3) {
                    this.editData[this.zbIndex].HMaterID = deptRow.HItemID;
                    this.editData[this.zbIndex].物料代码 = deptRow.物料代码;
                    this.editData[this.zbIndex].物料名称 = deptRow.物料名称;
                    this.editData[this.zbIndex].HUnitID = deptRow.HUnitID;
                    this.editData[this.zbIndex].规格型号 = deptRow.规格型号
                    this.editData[this.zbIndex].计量单位 = deptRow.计量单位名称
                    this.editData[this.zbIndex].HTaxPrice = deptRow.含税成本价
                    this.editData[this.zbIndex].HTaxRate = deptRow.默认税率
                    this.materialShow = false
                    this.openData = false
                } else if (num == 4) {
                    this.form.HEmpName = deptRow.职员名称
                    this.form.HEmpID = deptRow.HItemID
                    this.gyEmployeeShow = false
                    this.openData = false
                        }
                    }).catch(error => {
                        this.$modal.msgError("接口请求失败!");
                    })
                } else {
                    this.$modal.msgError("不允许选择不同的部门数据!", sessionStorage["HTranSlate"]);
                }
            } else {
                this.$modal.msgError("请选择单条数据!");
                this.$modal.msgError("请选择数据!");
            }
        },
        emitData(deptRow, num) {
            this.dialogTypeNum = num
@@ -651,33 +845,28 @@
            this.deptform = {}
            this.openData = false
        },
        //新增编辑表单初始化
        reset() {
            this.form = {
                HOrgID: sessionStorage["OrganizationID"] - 0,
                HWorksNumber: '',
                HDate: moment(new Date()).format('YYYY-MM-DD'),
                HSourceBillType: 1,
                HSourceBillType: '1',
                HSourceBillNo: '',
                HBarCodeType: '',
                HBarCodeType: '唯一条码',
            }
            this.editWlxxData = []
            this.editBtData = []
            this.ids = []
            this.subDisabled = false
            this.addBtnShow = false
            // this.$refs.tableData.clearSelection()
            this.activeName = 'first'
            this.resetForm("form");
        },
        //退出
        close() {
            this.reset()
            console.log(1111)
            console.log(this.$route.path)
            if (!this.OperationType && !this.copyType) {
                console.log(this.$route.path)
                const obj = { fullPath: this.$route.path, path: this.$route.path, name: this.$route.name, };
                this.$tab.closePage(obj).then(res => {
                    const latestView = res.visitedViews.slice(-1)[0]
@@ -721,39 +910,10 @@
                this.formLoading = false
            })
        },
        //获取对应的条码明细
        getBarCodeNoteBySellOutBill(rowHmainid) {
            axios.get(this.baseURL + '/Kf_SellOutBill/BarCodeNote', {
                params: { "HInterID": rowHmainid }
            }).then(response => {
                if (response.data.count == 1) {
                    if (response.data.data[2].length > 0) {
                        this.$modal.msgError("当前单据由扫码生成,不可以编辑!");
                        this.subDisabled = true
                    }
                } else { }
            }).catch(error => {
                this.$modal.msgError("接口请求失败!");
            });
        },
        //#region 根据客户获取客户余额
        getCustomerBalance(HCusID) {
            axios.get(this.baseURL + '/Xs_CusRatingChangeBill/getCustomerBalance', {
                params: { "HCusID": HCusID, 'CurUserName': sessionStorage["HUserName"] }
            }).then(response => {
                var data = response.data.data[0];
                this.form.HCusBalance = data.HCusBalance
                this.form.HCreditRating_Now = data.HCreditRating_Now
                this.form.HAvailableBalance = data.HAvailableBalance
            }).catch(error => {
                this.$modal.msgError("接口请求失败!");
            });
        },
        /** 修改按钮操作 */
        handleUpdate() {
            this.reset()
            let rowHmainid = this.linterid
            console.log(this.linterid)
            axios.get(this.baseURL + "/Kf_SellOutBill/cx", {
                params: { 'HInterID': rowHmainid }
            }).then(response => {
@@ -829,8 +989,6 @@
                    //  this.form.HAvailableBalance=data
                    this.form.HPriceType = data.单价类型
                    this.form.HOrgID = data.HOrgID
                    this.getCustomerByCusID(response.data.data[0].HSupID)//根据客户获取联系人,联系人电话
                    this.getBarCodeNoteBySellOutBill(rowHmainid)//获取对应的条码明细是否可编辑
                    for (var i = 0; i < result.data.length; i++) {
                        this.editWlxxData.push(
                            {
@@ -921,6 +1079,12 @@
        },
        /** 销售出库子表明细序号 */
        wlxxzbRowSysZbIndex({ row, rowIndex }) {
            row.index = rowIndex + 1;
        },
        tiaomaZbIndex({ row, rowIndex }) {
            row.index = rowIndex + 1;
        },
        danganZbIndex({ row, rowIndex }) {
            row.index = rowIndex + 1;
        },
        /** 编辑页子表添加按钮操作 */
@@ -1014,11 +1178,11 @@
                this.$refs.wlxxzbTable.toggleRowSelection(del_row, false) //设置这一行取消选中
            }
        },
        handleTableDangan(selection) {
            this.danganSelList = selection
        },
        showReset() {
            this.deptShow = false
            this.warehouseShow = false
            this.materialShow = false
            this.gyEmployeeShow = false
            this.ScICMOBillShow = false
        },
        //  打开数据列表弹窗
        openDataDialog(num, row) {
@@ -1027,23 +1191,11 @@
                this.zbIndex = row.index - 1
            }
            this.showReset()
            if (num == 1) {
                this.dialogTitle = '部门列表'
                this.deptShow = true
            this.HSouceBillType = this.getSupType()
            this.dialogTitle = this.getSupType() + '列表'
            this.ScICMOBillShow = true
                this.openData = true
            } else if (num == 2) {
                this.dialogTitle = '出库仓库列表'
                this.warehouseShow = true
                this.openData = true
            } else if (num == 3) {
                this.dialogTitle = '物料列表'
                this.materialShow = true
                this.openData = true
            } else if (num == 4) {
                this.dialogTitle = '销售员列表'
                this.gyEmployeeShow = true
                this.openData = true
            }
        },
    }
};