You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1821 lines
65 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="采购订单号" prop="poNo">
<el-input
v-model="queryParams.poNo"
placeholder="请输入采购订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="销售订单号" prop="saleorderCode">
<el-input
v-model="queryParams.saleorderCode"
placeholder="请输入销售订单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料编号" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格参数" prop="barcodeSpec">
<el-input
v-model="queryParams.barcodeSpec"
placeholder="请输入规格参数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批次标识" prop="batchFlag">
<el-select v-model="queryParams.batchFlag" placeholder="请选择批次标识" clearable>
<el-option
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="打印标识" prop="printFlag">
<el-select v-model="queryParams.printFlag" placeholder="请选择打印标识" clearable>
<el-option
v-for="dict in dict.type.mes_print_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:barcode:add']"
>采购新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleRelateAdd"
v-hasPermi="['mes:barcode:add']"
>采购合并新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleNoPurchaseAdd"
v-hasPermi="['mes:barcode:noPurchaseAdd']"
>无采购订单新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleRegularAdd"
v-hasPermi="['mes:barcode:regularAdd']"
>固定条码新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-printer"
size="mini"
@click="handlePrintBarcodes"
:disabled="batchPrintBtnDisabled"
v-hasPermi="['mes:barcode:printBarcode']"
>打印
</el-button>
</el-col>
<!--right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar-->
</el-row>
<el-table v-loading="loading" :data="barcodeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="barcodeId" v-if="columns[0].visible"/>
<el-table-column label="条码类型" align="center" prop="barcodeType" v-if="columns[4].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.barcode_type" :value="scope.row.barcodeType"/>
</template>
</el-table-column>
<el-table-column label="采购订单号" align="center" prop="poNo" v-if="columns[13].visible" width="100"/>
<el-table-column label="销售订单号" align="center" prop="saleorderCode" v-if="columns[29].visible" width="100"/>
<el-table-column label="安全库存" align="center" prop="safeFlag" v-if="columns[30].visible" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_safe_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<el-table-column label="批次代码" align="center" prop="batchCode" v-if="columns[6].visible" width="100"/>
<el-table-column label="条码内容" align="center" prop="barcodeInfo" v-if="columns[5].visible" width="100"/>
<el-table-column label="物料编码" align="center" prop="materialCode" v-if="columns[31].visible" width="100"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[8].visible" width="100"/>
<el-table-column label="规格参数" align="center" prop="barcodeSpec" v-if="columns[33].visible" width="150"/>
<el-table-column label="批次标识" align="center" prop="batchFlag" v-if="columns[3].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.batchFlag"/>
</template>
</el-table-column>
<el-table-column label="供应商ID" align="center" prop="manufacturerId" v-if="columns[9].visible"/>
<el-table-column label="批次数量" align="center" prop="amount" v-if="columns[10].visible"/>
<el-table-column label="打印标识" align="center" prop="printFlag" v-if="columns[12].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_print_flag" :value="scope.row.printFlag"/>
</template>
</el-table-column>
<el-table-column label="生产日期" align="center" prop="productionDate" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.productionDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="接受日期" align="center" prop="acceptedDate" width="180" v-if="columns[15].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.acceptedDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="打印人" align="center" prop="printPerson" v-if="columns[2].visible"/>
<el-table-column label="打印时间" align="center" prop="printTime" width="180" v-if="columns[1].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.printTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="最晚出库日期" align="center" prop="lastOutstockDate" width="180"
v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.lastOutstockDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="托盘RFID代码" align="center" prop="palletInfoCode" v-if="columns[7].visible" width="110"/>
<el-table-column label="派工单号" align="center" prop="planCode" v-if="columns[17].visible"/>
<el-table-column label="生产明细编号" align="center" prop="planDetailCode" v-if="columns[18].visible"/>
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" v-if="columns[19].visible"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[20].visible"/>
<el-table-column label="项目号" align="center" prop="projectNo" v-if="columns[21].visible"/>
<el-table-column label="流水号" align="center" prop="serialNumber" v-if="columns[22].visible"/>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[23].visible"/>
<el-table-column label="绑定状态" align="center" prop="bindStatus" v-if="columns[24].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.bind_status" :value="scope.row.bindStatus"/>
</template>
</el-table-column>
<el-table-column label="绑定托盘的人" align="center" prop="bindBy" v-if="columns[25].visible" width="110"/>
<el-table-column label="绑定托盘时间" align="center" prop="bindTime" width="180" v-if="columns[26].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.bindTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[27].visible"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[28].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.printFlag !==PRINT_FLAG.YES && scope.row.barcodeType === BARCODE_TYPE.RAW &&
scope.row.purchaseOrderId && scope.row.purchaseOrderId!==null"
v-hasPermi="['mes:barcode:edit']"
>编辑
</el-button>
<!--el-button
size="mini"
type="text"
icon="el-icon-refresh"
@click="regenerateBarcode(scope.row)"
v-if="scope.row.printFlag ==='1'"
v-hasPermi="['mes:barcode:regenerate']"
>重新生成
</el-button-->
<el-button
size="mini"
type="text"
icon="el-icon-printer"
@click="handlePrintBarcodes(scope.row)"
v-if="scope.row.printFlag ==='0'"
v-hasPermi="['mes:barcode:printBarcode']"
>打印
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-printer"
@click="reprintBarcodes(scope.row)"
v-if="scope.row.printFlag ==='1'"
v-hasPermi="['mes:barcode:reprint']"
>补打印
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改条码信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="采购订单号" prop="poNo">
<el-input v-model="form.poNo" placeholder="请点击右侧检索采购订单" disabled>
<el-button slot="append" icon="el-icon-search" @click="handlePurchaseOrderAdd"
v-if="!form.barcodeId || form.barcodeId===''"></el-button>
</el-input>
</el-form-item>
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="form.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="form.materialCode" :disabled="true"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" :disabled="true"/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input v-model="form.materialSpec" :disabled="true"/>
</el-form-item>
<el-form-item label="规格参数" prop="barcodeSpec">
<el-input v-model="form.barcodeSpec" :disabled="true"/>
</el-form-item>
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="form.batchFlag" :disabled="saleBatchFlagDisable">
<el-radio
v-for="dict in dict.type.mes_material_batch_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="供应商ID" prop="manufacturerId">-->
<!-- <el-input v-model="form.manufacturerId" placeholder="请输入供应商ID" />-->
<!-- </el-form-item>-->
<el-form-item prop="amount" v-if="form.batchFlag===BATCH_FLAG.YES">
<span slot="label">
<el-tooltip content="每个物料条码中包含的数量一袋螺丝有60个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
批次数量
</span>
<el-input v-model="form.amount" placeholder="请在物料信息中维护"/>
</el-form-item>
<el-form-item prop="barcodeAmount" v-if="!form.barcodeId || form.barcodeId===''">
<span slot="label">
<el-tooltip content="需要打印条码的数量如果需要贴10个物料条码则需要生成10个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
条码数量
</span>
<el-input v-model="form.barcodeAmount"/>
<span><b>可用数量:</b>{{ form.availableBindAmount }} </span>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="form.productionDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生产日期">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="接受日期" prop="acceptedDate">-->
<!-- <el-date-picker clearable-->
<!-- v-model="form.acceptedDate"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择接受日期">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="最晚出库日期" prop="lastOutstockDate">
<el-date-picker clearable
v-model="form.lastOutstockDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最晚出库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
<!-- <el-form-item label="绑定状态" prop="bindStatus">-->
<!-- <el-radio-group v-model="form.bindStatus">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.bind_status"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="绑定托盘的人" prop="bindBy">-->
<!-- <el-input v-model="form.bindBy" placeholder="请输入绑定托盘的人" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="绑定托盘时间" prop="bindTime">-->
<!-- <el-date-picker clearable-->
<!-- v-model="form.bindTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择绑定托盘时间">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="submitLoading" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加采购订单对话框 -->
<el-dialog title="选择采购订单信息" :visible.sync="purchaseOrderOpen" append-to-body>
<select-orderBind ref="purchaseOrderRef" v-if="purchaseOrderOpen" :defineData="barcodeData"></select-orderBind>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitPurchaseOrderForm"> </el-button>
<el-button @click="purchaseOrderOpen = false"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改对内生产的原材料条码信息对话框 -->
<el-dialog :title="title" :visible.sync="internalOpen" width="500px" append-to-body>
<el-form ref="internalForm" :model="internalForm" :rules="internalRules" label-width="100px">
<el-form-item label="成品条码" prop="productBarcode">
<el-input v-model="internalForm.productBarcode" placeholder="请输入或扫描成品条码" class="input-with-select"
@blur="selectProductBarcodeInfoByBarcodeInfo">
<el-button slot="append" icon="el-icon-full-screen"></el-button>
</el-input>
</el-form-item>
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="internalForm.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="internalForm.materialCode" disabled/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="internalForm.materialName" :disabled="true"/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input v-model="internalForm.materialSpec" :disabled="true"/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="internalForm.productionDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生产日期">
</el-date-picker>
</el-form-item>
<el-form-item label="最晚出库日期" prop="lastOutstockDate">
<el-date-picker clearable
v-model="internalForm.lastOutstockDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最晚出库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="internalForm.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitInternalForm"> </el-button>
<el-button @click="cancelInternal"> </el-button>
</div>
</el-dialog>
<!-- 无采购订单的原材料条码信息对话框 -->
<el-dialog :title="title" :visible.sync="noPurchaseOpen" width="500px" append-to-body>
<el-form ref="noPurchaseForm" :model="noPurchaseForm" :rules="noPurchaseRules" label-width="100px">
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="noPurchaseForm.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="noPurchaseForm.materialCode" suffix-icon="el-icon-search" readonly
@click.native="handleSelectMaterial"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="noPurchaseForm.materialName" readonly/>
</el-form-item>
<el-form-item label="物料规格" prop="barcodeSpec">
<el-input v-model="noPurchaseForm.barcodeSpec" type="textarea" readonly/>
</el-form-item>
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="noPurchaseForm.batchFlag">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="供应商ID" prop="manufacturerId">-->
<!-- <el-input v-model="form.manufacturerId" placeholder="请输入供应商ID" />-->
<!-- </el-form-item>-->
<!--el-form-item prop="amount" v-if="noPurchaseForm.batchFlag==='1'">
<span slot="label">
<el-tooltip content="每个物料条码中包含的数量一袋螺丝有60个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
批次数量
</span>
<el-input v-model="noPurchaseForm.amount" placeholder="请在物料信息中维护" />
</el-form-item-->
<el-form-item prop="barcodeAmount">
<span slot="label">
<el-tooltip content="需要打印条码的数量如果需要贴10个条码则需要生成10个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
条码数量
</span>
<el-input v-model="noPurchaseForm.barcodeAmount"/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="noPurchaseForm.productionDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生产日期">
</el-date-picker>
</el-form-item>
<el-form-item label="最晚出库日期" prop="lastOutstockDate">
<el-date-picker clearable
v-model="noPurchaseForm.lastOutstockDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最晚出库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="noPurchaseForm.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="submitLoading" @click="submitNoPurchaseAddForm"> </el-button>
<el-button @click="cancelNoPurchase"> </el-button>
</div>
</el-dialog>
<!-- 固定原材料条码信息对话框 -->
<el-dialog :title="title" :visible.sync="regularOpen" width="500px" append-to-body>
<el-form ref="regularForm" :model="regularForm" :rules="regularRules" label-width="100px">
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="regularForm.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="regularForm.materialCode" suffix-icon="el-icon-search" readonly
@click.native="handleSelectMaterial"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="regularForm.materialName" readonly/>
</el-form-item>
<el-form-item label="物料规格" prop="barcodeSpec">
<el-input v-model="regularForm.barcodeSpec" readonly/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="regularForm.productionDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生产日期">
</el-date-picker>
</el-form-item>
<el-form-item label="最晚出库日期" prop="lastOutstockDate">
<el-date-picker clearable
v-model="regularForm.lastOutstockDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最晚出库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="regularForm.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitRegularAddForm"> </el-button>
<el-button @click="cancelRegular"> </el-button>
</div>
</el-dialog>
<!-- 选择物料对话框 -->
<el-dialog title="选择物料信息" :visible.sync="selectMaterialVisible" append-to-body>
<select-material ref="selectMaterialRef" v-if="selectMaterialVisible"></select-material>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSelectMaterialForm"> </el-button>
<el-button @click="selectMaterialVisible = false"> </el-button>
</div>
</el-dialog>
<!-- 采购订单合并条码信息对话框 -->
<el-dialog :title="materialRelateTitle" :visible.sync="materialRelateOpen" width="900px" append-to-body>
<el-form ref="materialRelateForm" :model="materialRelateForm" :rules="materialRelateRules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="采购订单" prop="poNo">
<el-input v-model="materialRelateForm.poNo" placeholder="请点击右侧检索采购订单" readonly>
<el-button slot="append" icon="el-icon-search" @click="handlePurchaseOrderBatchAdd"></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售订单" prop="saleorderCode">
<el-input v-model="materialRelateForm.saleorderCode" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="采购物料" prop="materialId">
<el-table :data="materialRelateForm.mesSaleOrderRelateList" :row-class-name="rowMesBaseMaterialRelateIndex"
@selection-change="handleMesBaseMaterialRelateSelectionChange" ref="mesBaseMaterialRelate">
<el-table-column label="序号" align="center" prop="index"/>
<el-table-column label="采购订单" align="center" prop="purchaseOrderId"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="规格参数" align="center" prop="materialSpec"/>
<el-table-column label="可用数量" align="center" prop="relateSaleOrderAmount"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDeletePurchaseOrder(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item label="条码数量" prop="barcodeAmount">
<el-input v-model="materialRelateForm.barcodeAmount" disabled/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="materialRelateForm.productionDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生产日期">
</el-date-picker>
</el-form-item>
<el-form-item label="最晚出库日期" prop="lastOutstockDate">
<el-date-picker clearable
v-model="materialRelateForm.lastOutstockDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最晚出库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="materialRelateForm.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="submitLoading" @click="submitRelateForm"> </el-button>
<el-button @click="cancelRelate"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode, reprintBarcodes,
printBarcodes, getMaterialInfoByErpId, selectProductBarcodeInfoByBarcodeInfo,
addInternalBarcode, regenerateBarcode, checkRawStock, addNoPurchaseBarcode, addRegularBarcode,
mergeAddBarcode, mergeUpdateBarcode
} from "@/api/mes/barcode";
import {checkWarehouseMaterials} from "@/api/wms/wmswarehouse";
import selectOrderBind from '@//views/mes/purchaseOrder/selectOrderBind.vue';
import selectMaterial from '@//views/mes/materialinfo/selectMaterial.vue';
import {getMaterialinfo} from "@/api/mes/materialinfo";
export default {
name: "Barcode",
dicts: ['bind_status', 'active_flag', 'barcode_type', 'mes_safe_flag', 'mes_print_flag', 'mes_material_batch_flag'],
components: {
'select-orderBind': selectOrderBind,
'select-material': selectMaterial
},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
barcodeInfos: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 条码信息表格数据
barcodeList: [],
// 是否显示采购订单弹出层
purchaseOrderOpen: false,
//是否显示选择物料弹出层
selectMaterialVisible: false,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
submitLoading: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
printTime: null,
printPerson: null,
printFlag: null,
batchFlag: null,
barcodeType: "1",
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null,
rawFlag: '1'
},
// 表单参数
form: {},
// 表单校验
rules: {
poNo: [
{required: true, message: "采购订单号不能为空", trigger: "change"}
],
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
barcodeAmount: [
{required: true, message: "条码数量不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
},
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `打印时间`, visible: true},
{key: 2, label: `打印人`, visible: true},
{key: 3, label: `批次标识`, visible: true},
{key: 4, label: `条码类型`, visible: false},
{key: 5, label: `条码内容`, visible: true},
{key: 6, label: `批次代码`, visible: true},
{key: 7, label: `托盘RFID代码`, visible: true},
{key: 8, label: `物料名称`, visible: true},
{key: 9, label: `供应商ID`, visible: false},
{key: 10, label: `数量`, visible: true},
{key: 11, label: `打印机台名称`, visible: true},
{key: 12, label: `打印标识`, visible: true},
{key: 13, label: `采购订单号`, visible: true},
{key: 14, label: `生产日期`, visible: true},
{key: 15, label: `接受日期`, visible: true},
{key: 16, label: `最晚出库日期`, visible: true},
{key: 17, label: `派工单号`, visible: false},
{key: 18, label: `生产明细编号`, visible: false},
{key: 19, label: `销售订单ID`, visible: false},
{key: 20, label: `销售订单编号`, visible: false},
{key: 21, label: `项目号`, visible: false},
{key: 22, label: `流水号`, visible: false},
{key: 23, label: `备注`, visible: true},
{key: 24, label: `绑定状态`, visible: true},
{key: 25, label: `绑定托盘的人`, visible: true},
{key: 26, label: `绑定托盘时间`, visible: true},
{key: 27, label: `更新人`, visible: false},
{key: 28, label: `更新时间`, visible: false},
{key: 29, label: `销售订单号`, visible: true},
{key: 30, label: `安全库存`, visible: true},
{key: 31, label: `物料编码`, visible: true},
{key: 32, label: `物料规格`, visible: true},
{key: 33, label: `规格参数`, visible: true},
],
internalOpen: false,
// 对内条码表单参数
internalForm: {},
// 表单校验
internalRules: {
productBarcode: [
{required: true, message: "成品条码不能为空", trigger: "change"}
],
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
},
noPurchaseOpen: false,
// 对内条码表单参数
noPurchaseForm: {},
noPurchaseBatchFlagDisable: true,
noPurchaseBatchAmountDisabled: true,
saleBatchFlagDisable: true,
orderBindAmount: 0,
safeBindAmount: 0,
// 表单校验
noPurchaseRules: {
materialCode: [
{required: true, message: "物料不能为空", trigger: "change"}
],
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "blur"}
],
barcodeAmount: [
{required: true, message: "条码数量不能为空", trigger: "change"}
],
materialCode11: [
{required: true, message: "物料不能为空", trigger: "change"}
],
},
regularOpen: false,
// 固定条码表单参数
regularForm: {},
// 表单校验
regularRules: {
materialCode: [
{
required: true, message: "物料不能为空", trigger: ["blur", "change"]
}
],
},
batchPrintBtnDisabled: false,
BATCH_FLAG: {
YES: '1',
NO: '0'
},
// 子表选中数据
checkedMesBaseMaterialRelate: [],
// 关联的物料信息;用来在创建虚拟物料时,关联的物料信息表格数据
barcodeData: {},
materialRelateTitle: '',
materialRelateOpen: false,
// 对内条码表单参数
materialRelateForm: {},
// 表单校验
materialRelateRules: {
productBarcode: [
{required: true, message: "成品条码不能为空", trigger: "change"}
],
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
poNo: [
{required: true, message: "采购信息不能为空", trigger: "blur"}
],
},
PRINT_FLAG: {
YES: "1",
NO: "0"
},
SINGLE_FLAG: {
NO: "0",
YES: "1",
INTERNAL: "2",
MERGE: "3"
},
BARCODE_TYPE: {
RAW: "1",
REGULAR: "9"
},
};
},
created() {
this.getList();
},
// watch: {
// 'form.batchFlag': function (newVal, oldVal) {
// // 在 form.batchFlag 变化时执行
// if (newVal === '1') {
// this.amountVisible = true;
// } else if (newVal === '0') {
// this.amountVisible = false;
// }
// },
// },
methods: {
/** 查询条码信息列表 */
getList() {
this.loading = true;
listBarcode(this.queryParams).then(response => {
this.barcodeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
barcodeAmount: null,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
remark: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null,
availableBindAmount: 0,
currentSafeBindAmount: 0
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.barcodeId)
this.barcodeInfos = selection.map(item => item.barcodeInfo)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleSelection(selection) {
this.ids = selection.map(item => item.barcodeId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增采购订单按钮操作 */
handlePurchaseOrderAdd() {
this.barcodeData = {mergeFlag: null};
this.purchaseOrderOpen = true;
},
findAllDuplicates(arrayOfObjects, property) {
const duplicates = {};
arrayOfObjects.forEach(obj => {
const value = obj[property];
if (!duplicates[value]) {
duplicates[value] = [];
}
duplicates[value].push(obj);
});
return Object.values(duplicates).filter(group => group.length > 1);
},
/** 提交采购订单按钮 */
submitPurchaseOrderForm() {
if (this.materialRelateOpen) {
let selectedRows = this.$refs.purchaseOrderRef.selectedRows;
if (!selectedRows || selectedRows.length <= 0) {
this.$modal.msgWarning("请选择采购订单");
return;
}
let firstRow = selectedRows[0];
let firstRowPoNo = firstRow.poNo;
let firstRowSaleOrderCode = firstRow.saleOrderCode;
if (this.materialRelateForm.poNo && this.materialRelateForm.poNo !== '') {
if (firstRowPoNo !== this.materialRelateForm.poNo) {
this.$modal.msgError("已选择采购订单号为:" + firstRowPoNo + ",本次选择采购订单号与此不同");
return;
}
if (firstRowSaleOrderCode !== this.materialRelateForm.saleorderCode) {
this.$modal.msgError("已选择销售订单号为:" + firstRowSaleOrderCode + ",本次选择销售订单号与此不同");
return;
}
}
let differentPoNoSelectedRow = selectedRows.find(item => {
return item.poNo !== firstRowPoNo || item.saleOrderCode !== firstRowSaleOrderCode;
});
if (differentPoNoSelectedRow != null && differentPoNoSelectedRow !== '') {
this.$modal.msgError("本次选择信息采购订单号或销售订单号不一致");
return;
}
let unavailableAmountResult = selectedRows.find(item => {
return parseInt(item.relateSaleOrderAmount) !== 1;
});
if (unavailableAmountResult != null && unavailableAmountResult !== '') {
this.$modal.msgError("需要选择可用数量为1的信息");
return;
}
//可能获取几组数组相同saleorderid的数据
let sameSaleOrderIdsData = this.findAllDuplicates(selectedRows, "saleOrderId");
if (sameSaleOrderIdsData != null && sameSaleOrderIdsData.length > 0) {
let errorMsg = "";
let index = 1;
for (let sameDataGroup of sameSaleOrderIdsData) {
errorMsg += index + ".";
for (let ssoid of sameDataGroup) {
errorMsg += "销售订单号:" + ssoid.saleOrderCode + ",成品编码:" + ssoid.productCode + ",成品名称:" + ssoid.productName + ",成品规格:" + ssoid.productSpec + ";";
}
index++;
}
this.$modal.msgError("选择的销售订单明细不能相同" + errorMsg);
return;
}
let wmsWarehouseMaterialCheckVos = [];
selectedRows.forEach(item => {
// let obj = {
// materialId: item.materialId,
// materialCode: item.materialCode,
// materialName: item.materialName,
// materialSpec: item.materialSpec
// };
wmsWarehouseMaterialCheckVos.push(item);
})
//校验仓库配置信息warehousematerial
checkWarehouseMaterials(wmsWarehouseMaterialCheckVos).then(response => {
selectedRows.forEach(item => {
//同样的不能再添加
const filterMaterialRelateList = this.materialRelateForm.mesSaleOrderRelateList.filter(formItem => {
return formItem.orderBindId === item.orderBindId;
});
//同样销售订单的
const filterSaleOrderIdMaterialRelateList = this.materialRelateForm.mesSaleOrderRelateList.filter(formItem => {
return formItem.relateSaleOrderId === item.saleOrderId;
});
if (filterSaleOrderIdMaterialRelateList != null && filterSaleOrderIdMaterialRelateList.length > 0) {
let errorMsg = "选择的信息跟已经选择的销售订单号明细相同.";
for (let ssoid of filterSaleOrderIdMaterialRelateList) {
errorMsg += "销售订单号:" + ssoid.saleOrderCode + ",成品编码:" + ssoid.productCode + ",成品名称:" + ssoid.productName + ",成品规格:" + ssoid.productSpec + ";";
}
this.$modal.msgError(errorMsg);
return;
}
if (filterMaterialRelateList.length <= 0) {
let mesSaleOrderRelate = {
index: item.index,
orderBindId: item.orderBindId,
relateSaleOrderId: item.saleOrderId,
relateSaleOrderCode: item.saleOrderCode,
productId: item.productId,
productCode: item.productCode,
productName: item.productName,
productSpec: item.productSpec,
purchaseOrderId: item.purchaseOrderId,
materialId: item.materialId,
materialCode: item.materialCode,
materialName: item.materialName,
materialSpec: item.materialSpec,
specificationParameter: item.specificationParameter,
relateSaleOrderAmount: item.relateSaleOrderAmount,
orderAmount: item.orderAmount
};
this.materialRelateForm.mesSaleOrderRelateList.push(mesSaleOrderRelate);
}
});
this.materialRelateForm.poNo = firstRowPoNo;
this.materialRelateForm.saleorderCode = firstRowSaleOrderCode;
this.purchaseOrderOpen = false;
})
// alert(JSON.stringify(selectedRows));
} else {
this.submitSingleSelectPurchaseOrder();
}
},
submitSingleSelectPurchaseOrder() {
let selectedRow = this.$refs.purchaseOrderRef.selectedRow;
this.form.batchFlag = null;
this.form.amount = null;
this.form.materialCode = null;
this.form.materialId = null;
this.form.materialName = null;
this.form.materialSpec = null;
this.form.barcodeSpec = null;
this.form.projectNo = null;
this.form.purchaseOrderId = null;
//本次待生成订单条码数量
this.form.availableBindAmount = null;
//本次生成条码总数量
this.form.barcodeAmount = null;
this.form.poNo = null;
this.form.orderBindId = null;
if (selectedRow.relateSaleOrderAmount == null || selectedRow.relateSaleOrderAmount === '' || parseInt(selectedRow.relateSaleOrderAmount) <= 0) {
this.$modal.msgError("无可生成条码数量");
return;
}
this.$set(this.form, "poNo", selectedRow.poNo);
this.form.barcodeType = '1';//条码类型1原材料,2半成品,3成品,4背板
// this.form.materialId = selectedRow.materialId;//在物料信息中对应的是ERPID
this.form.materialId = selectedRow.materialId;//物料信息表中物料ID主键
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.form.materialSpec = selectedRow.materialSpec;
this.form.projectNo = selectedRow.projectNo;
this.form.purchaseOrderId = selectedRow.purchaseOrderId;
this.form.barcodeSpec = selectedRow.specificationParameter;
//本次可用条码数量
this.form.availableBindAmount = parseInt(selectedRow.relateSaleOrderAmount);
this.form.orderBindId = selectedRow.orderBindId;
//本次生成条码总数量
this.form.barcodeAmount = null;
this.form.batchFlag = selectedRow.batchFlag;
this.form.amount = selectedRow.batchAmount;
this.saleBatchFlagDisable = !!this.form.batchFlag;
this.purchaseOrderOpen = false;
},
handleDeletePurchaseOrder(row) {
const mesSaleOrderRelateList = this.materialRelateForm.mesSaleOrderRelateList;
this.materialRelateForm.mesSaleOrderRelateList = mesSaleOrderRelateList.filter(function (item) {
return row.index !== item.index
});
if (!this.materialRelateForm.mesSaleOrderRelateList || this.materialRelateForm.mesSaleOrderRelateList.length <= 0) {
this.materialRelateForm.poNo = null;
this.materialRelateForm.saleorderCode = null;
}
// if (this.checkedDmsBillsMaintDetailProject.length == 0) {
// this.$modal.msgError("请先选择要删除的保养工单明细项目信息;检查每个项目的点巡检结果详情数据");
// } else {
// const dmsBillsMaintDetailProjectList = this.dmsBillsMaintDetailProjectList;
// const checkedDmsBillsMaintDetailProject = this.checkedDmsBillsMaintDetailProject;
// this.dmsBillsMaintDetailProjectList = dmsBillsMaintDetailProjectList.filter(function(item) {
// return checkedDmsBillsMaintDetailProject.indexOf(item.index) == -1
// });
// }
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加原材料条码信息";
},
/** 打印条码按钮操作 */
handlePrintBarcodes(row) {
this.loading = true;
const barcodeIds = row.barcodeId || this.ids;
if (barcodeIds == null || barcodeIds === '' || barcodeIds.length===0) {
this.$modal.msgWarning("请选择要打印的物料条码");
this.loading = false;
return;
}
if (row.printFlag) {
// row.printFlag = '1';
} else {
this.batchPrintBtnDisabled = true;
}
printBarcodes(barcodeIds).then(response => {
this.$modal.msgSuccess("打印条码成功");
this.getList();
this.batchPrintBtnDisabled = false;
}).catch(() => {
}).finally(e => {
this.loading = false;
this.batchPrintBtnDisabled = false;
});
},
//对于已打印的条码可重新生成条码,之前的作废
regenerateBarcode(row) {
this.loading = true;
const barcodeId = row.barcodeId;
const barcodeInfo = row.barcodeInfo;
const barcodeType = row.barcodeType;
this.$modal.confirm('重新生成后之前的条码将会作废,是否确认重新生成条码内容为"' + barcodeInfo + '"的数据项?').then(function () {
return regenerateBarcode({"barcodeId": barcodeId, "barcodeInfo": barcodeInfo, "barcodeType": barcodeType});
}).then(() => {
this.getList();
this.$modal.msgSuccess("重新生成成功");
}).catch(() => {
}).finally(e => {
this.loading = false;
});
},
reprintBarcodes(row) {
this.loading = true;
const barcodeId = row.barcodeId;
const barcodeInfo = row.barcodeInfo;
this.$modal.confirm('请确认是否要补打印条码内容为"' + barcodeInfo + '"的数据项?').then(function () {
return reprintBarcodes(barcodeId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("重新打印成功");
}).catch(() => {
}).finally(e => {
this.loading = false;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
const barcodeId = row.barcodeId;
if (row.singleFlag === this.SINGLE_FLAG.MERGE) {
this.resetRelate();
getBarcode(barcodeId).then(response => {
this.materialRelateForm = response.data
let mesSaleOrderRelateList = this.materialRelateForm.mesSaleOrderRelateList;
if (mesSaleOrderRelateList !== null && mesSaleOrderRelateList.length > 0) {
let mesSaleOrderRelate = mesSaleOrderRelateList[0];
this.materialRelateForm.saleorderCode = mesSaleOrderRelate.relateSaleOrderCode;
}
this.materialRelateForm.barcodeAmount = 1;
this.materialRelateOpen = true;
this.materialRelateTitle = "修改合并原材料条码信息";
});
} else {
if (row.purchaseOrderId && row.purchaseOrderId!=null && row.purchaseOrderId > 0) {//有采购订单的
this.reset();
getBarcode(barcodeId).then(response => {
this.form = response.data
this.open = true;
this.title = "修改原材料条码信息";
});
} else {//有采购订单的
}
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.form.barcodeId && this.form.barcodeId !== '') {
updateBarcode(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
} else {
addBarcode(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const barcodeIds = row.barcodeId || this.ids;
const barcodeInfos = row.barcodeInfo || this.barcodeInfos;
this.$modal.confirm('是否确认删除原材料条码内容为"' + barcodeInfos + '"的数据项?').then(function () {
return delBarcode(barcodeIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/barcode/export', {
...this.queryParams
}, `barcode_${new Date().getTime()}.xlsx`)
},
// 表单重置
resetInternal() {
this.internalForm = {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
manufacturerId: null,
amount: null,
barcodeAmount: null,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
remark: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("internalForm");
},
/** 内部生产原材料条码新增按钮操作 */
handleInternalAdd() {
this.resetInternal();
this.internalOpen = true;
this.title = "添加生产新增原材料条码信息";
},
selectProductBarcodeInfoByBarcodeInfo() {
if (this.internalForm.productBarcode == null || this.internalForm.productBarcode === '') {
return;
}
selectProductBarcodeInfoByBarcodeInfo(this.internalForm.productBarcode).then(response => {
if (response.data == null) {
this.resetInternal();
this.$modal.msgError("成品信息不存在");
return;
}
this.$set(this.internalForm, "materialId", response.data.materialId);
this.$set(this.internalForm, "materialCode", response.data.materialCode);
this.$set(this.internalForm, "materialName", response.data.materialName);
this.$set(this.internalForm, "productionDate", response.data.productionDate);
this.$set(this.internalForm, "saleOrderId", response.data.saleOrderId);
this.$set(this.internalForm, "saleorderCode", response.data.saleorderCode);
}).catch(error => {
this.resetInternal();
}).finally(e => {
});
},
/** 提交按钮 */
submitInternalForm() {
this.$refs["internalForm"].validate(valid => {
if (valid) {
addInternalBarcode(this.internalForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.internalOpen = false;
this.getList();
});
}
});
},
// 取消按钮
cancelInternal() {
this.internalOpen = false;
this.resetInternal();
},
// 表单重置
resetNoPurchase() {
this.noPurchaseForm = {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName: null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
barcodeAmount: null,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
remark: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null,
confirmFlag: null
};
this.resetForm("noPurchaseForm");
},
/** 无采购订单新增按钮操作 */
handleNoPurchaseAdd() {
this.resetNoPurchase();
this.noPurchaseOpen = true;
this.title = "添加原材料条码信息";
},
handleSelectMaterial() {
this.selectMaterialVisible = true;
},
/** 提交选择物料按钮 */
submitSelectMaterialForm() {
if (this.noPurchaseOpen) {
let selectedRow = this.$refs.selectMaterialRef.selectedRow;
this.$set(this.noPurchaseForm, "materialCode", selectedRow.materialCode);
this.noPurchaseForm.barcodeType = '1';//条码类型1原材料,2半成品,3成品,4背板
this.noPurchaseForm.materialId = selectedRow.materialId;
this.noPurchaseForm.materialName = selectedRow.materialName;
this.noPurchaseForm.barcodeSpec = selectedRow.materialSpec;
this.noPurchaseForm.batchFlag = selectedRow.batchFlag;
if (this.noPurchaseForm.batchFlag == null || this.noPurchaseForm.batchFlag === '') {
this.noPurchaseBatchFlagDisable = false;
} else {
this.noPurchaseBatchFlagDisable = true;
if (this.noPurchaseForm.batchFlag === this.BATCH_FLAG.NO) {
this.noPurchaseForm.amount = 1;
} else if (this.noPurchaseForm.batchFlag === this.BATCH_FLAG.YES) {
this.noPurchaseForm.amount = selectedRow.batchAmount;
}
}
this.noPurchaseBatchAmountDisabled = this.noPurchaseForm.amount != null && this.noPurchaseForm.amount > 0;
this.selectMaterialVisible = false;
} else if (this.regularOpen) {
this.submitRegularSelectMaterialForm();
}
},
/** 无采购订单新增提交按钮 */
submitNoPurchaseAddForm() {
this.$refs["noPurchaseForm"].validate(valid => {
if (valid) {
this.submitLoading = true;
const checkNoPurchaseForm = {materialId: this.noPurchaseForm.materialId};
const noPurchaseForm = this.noPurchaseForm;
checkRawStock(checkNoPurchaseForm).then(response => {
if (response.data) {
this.$modal.confirm('已经有此物料库存,请确认是否继续生成条码?').then(function () {
return addNoPurchaseBarcode(noPurchaseForm)
}).then(() => {
this.$modal.msgSuccess("新增成功");
this.noPurchaseOpen = false;
this.getList();
}).catch(() => {
});
} else {
addNoPurchaseBarcode(this.noPurchaseForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.noPurchaseOpen = false;
this.getList();
});
}
}).finally(e => {
this.submitLoading = false;
});
}
});
},
// 取消按钮
cancelNoPurchase() {
this.noPurchaseOpen = false;
this.resetNoPurchase();
},
// 表单重置
resetRegular() {
this.regularForm = {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName: null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
barcodeAmount: null,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
remark: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("regularForm");
},
/** 固定条码新增按钮操作 */
handleRegularAdd() {
this.resetRegular();
this.regularOpen = true;
this.title = "添加原材料条码信息";
},
/** 提交选择物料按钮 */
submitRegularSelectMaterialForm() {
let selectedRow = this.$refs.selectMaterialRef.selectedRow;
this.regularForm.barcodeType = '9';//条码类型1原材料,2半成品,3成品,4背板,9固定条码
this.$set(this.regularForm, "materialCode", selectedRow.materialCode);
this.regularForm.materialId = selectedRow.materialId;
this.regularForm.materialName = selectedRow.materialName;
this.regularForm.barcodeSpec = selectedRow.materialSpec;
this.selectMaterialVisible = false;
},
/** 固定条码新增提交按钮 */
submitRegularAddForm() {
this.$refs["regularForm"].validate(valid => {
if (valid) {
this.submitLoading = true;
addRegularBarcode(this.regularForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.regularOpen = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
}
});
},
// 取消按钮
cancelRegular() {
this.regularOpen = false;
this.resetRegular();
},
rowMesBaseMaterialRelateIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 复选框选中数据 */
handleMesBaseMaterialRelateSelectionChange(selection) {
this.checkedMesBaseMaterialRelate = selection.map(item => item.index)
},
// 表单重置
resetRelate() {
this.materialRelateForm = {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
barcodeSpec: null,
manufacturerId: null,
amount: null,
barcodeAmount: 1,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
remark: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null,
availableBindAmount: 0,
currentSafeBindAmount: 0,
mesSaleOrderRelateList: []
};
this.resetForm("materialRelateForm");
},
/** 新增按钮操作 */
handleRelateAdd() {
this.resetRelate();
this.materialRelateOpen = true;
this.materialRelateTitle = "添加合并原材料条码信息";
},
/** 批量选择采购订单按钮操作 */
handlePurchaseOrderBatchAdd() {
this.barcodeData = {mergeFlag: '1'};
this.purchaseOrderOpen = true;
},
// 取消按钮
cancelRelate() {
this.resetRelate();
this.materialRelateOpen = false;
},
/** 提交按钮 */
submitRelateForm() {
this.$refs["materialRelateForm"].validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.materialRelateForm.mesSaleOrderRelateList.length <= 1) {
this.$modal.msgError("请选择至少2条采购信息");
return;
}
if (this.materialRelateForm.barcodeId && this.materialRelateForm.barcodeId != '') {
mergeUpdateBarcode(this.materialRelateForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.materialRelateOpen = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
} else {
mergeAddBarcode(this.materialRelateForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.materialRelateOpen = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
}
}
});
},
}
};
</script>