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

2661 lines
97 KiB

<template>
<div>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 5px;margin-top: -5px;">
<el-form-item label="BU" prop="bu">
<el-input v-model="modalData.buNo" disabled style="width: 100px"></el-input>
</el-form-item>
<el-form-item prop="partNo">
<span slot="label">物料编码</span>
<el-input v-model="modalData.partNo" disabled style="width: 150px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'" prop="partDesc">
<el-input v-model="modalData.partDesc" disabled style="width: 340px"></el-input>
</el-form-item>
<el-form-item :label="'物料单位'">
<el-input v-model="modalData.printUnitName" disabled style="width: 100px"></el-input>
</el-form-item>
<el-form-item :label="'制造类型'" prop="bomType">
<el-select v-model="modalData.bomType" :disabled="modalDisableFlag" style="width: 130px">
<el-option label="Manufacturing" value="Manufacturing"></el-option>
<el-option label="Repair" value="Repair"></el-option>
<el-option label="Purchase" value="Purchase"></el-option>
<el-option label="Prototype" value="Prototype"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;">
<el-form-item label="生效日期" prop="effPhaseInDate">
<el-date-picker
style="width: 130px"
v-model="modalData.effPhaseInDate"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="请选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="失效日期">
<el-date-picker
:readonly="!modalDisableFlag"
style="width: 130px"
v-model="modalData.effPhaseOutDate"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="请选择日期">
</el-date-picker>
</el-form-item>
<el-form-item :label="'BOM版本号'" prop="engChgLevel">
<el-input-number :controls="false" :step="0" v-model="modalData.engChgLevel" :disabled="modalDisableFlag" style="width: 80px"></el-input-number>
</el-form-item>
<el-form-item :label="'工程版本号'">
<el-input v-model="modalData.engRevision" style="width: 80px"></el-input>
</el-form-item>
<el-form-item :label="'净重'">
<el-input-number :controls="false" :step="0" v-model="modalData.netWeight" style="width: 80px"></el-input-number>
</el-form-item>
<el-form-item prop="processUnit">
<span slot="label" @click="getBaseList(510)"><a>工序单位</a></span>
<el-input v-model="modalData.processUnitName" readonly style="width: 100px"></el-input>
</el-form-item>
<el-form-item :label="'损耗率%'">
<el-input-number :controls="false" :step="0" disabled v-model="modalData.shrinkageFactor" style="width: 78px"></el-input-number>
</el-form-item>
<el-form-item>
<el-button v-if="modalData.flag === '1' && headerSaveFlag" :loading="saveHeaderLoading" type="primary" @click="saveBomHeader" style="margin-top: 23px;width: 100px">保存</el-button>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;">
<el-form-item label="备注">
<el-input type="textarea" v-model="modalData.noteText" :rows="3" resize='none' show-word-limit style="width: 885px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-tabs v-model="detailTable" style="margin-top: 50px; width: 100%; min-height: 120px" type="border-card" class="detail-tab">
<!-- BOM明细信息页签 -->
<el-tab-pane label="Product Structure" name="bom_detail">
<el-form label-position="top" style="margin-top: -10px">
<el-form-item>
<el-button type="primary" :loading="alternativeLoading" @click="updateBomDetail" style="margin-left: 7px">编辑</el-button>
<el-button v-if="detailData.status === 'Tentative' || detailData.status === 'Obsolete'" type="primary" :loading="alternativeLoading" @click="updateStatusToBuildable">Build</el-button>
<el-button v-if="detailData.status === 'Buildable' && (modalData.effPhaseOutDate == null || modalData.effPhaseOutDate === '')" type="primary" :loading="alternativeLoading" @click="updateStatusToObsolete">Retire</el-button>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="detailData" :rules="rules" style="margin-left: 7px">
<el-form-item :label="'替代编码'">
<el-select v-model="detailData.alternativeNo" @change="alternativeChange" style="width: 165px">
<el-option
v-for = "(i, index) in detailDataList"
:key = "index"
:label = "i.alternativeNo"
:value = "i.alternativeNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="'替代名称'">
<el-input v-model="detailData.alternativeDescription" readonly style="width: 300px"></el-input>
</el-form-item>
<el-form-item :label="'状态'">
<el-input v-model="detailData.status" readonly style="width: 150px"></el-input>
</el-form-item>
<el-form-item :label="'最小订单数'">
<el-input class="inlineNumber numInput" v-model="detailData.minLotQty" readonly type="number" style="width: 100px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px">
<el-form-item label="备注">
<el-input type="textarea" v-model="detailData.detailNoteText" :rows="3" resize='none' show-word-limit readonly style="width: 885px;height: 20px"></el-input>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<el-tabs v-model="subDetailTable" style="width: 100%; min-height: 350px" type="border-card" @tab-click="queryBomComponentTable" class="sub_detail-tab">
<!-- BOM子明细信息页签 -->
<el-tab-pane label="Components" name="bom_sub_detail">
<el-form label-position="top" style="margin-top: 7px">
<el-form-item>
<el-button type="primary" :loading="alternativeLoading" @click="saveComponentModal" style="margin-left: 7px">新增</el-button>
<el-button type="primary" :loading="alternativeLoading" @click="batchSaveComponentModal" style="margin-left: 7px">批量新增</el-button>
<el-button type="primary" :loading="alternativeLoading" @click="batchUpdateOperationModal" style="margin-left: 7px">编辑工序</el-button>
<el-button type="primary" icon="el-icon-upload" @click="bomComponentUpload">导入</el-button>
<el-button type="primary" :loading="alternativeLoading" @click="deleteComponentPart">删除</el-button>
</el-form-item>
</el-form>
<div class="rq ">
<el-table
:data="subDetailList"
height="256px"
border
@selection-change="componentSelectionChange"
style="width:100%">
<el-table-column type="selection" align="center" width="50"></el-table-column>
<el-table-column
v-for="(item,index) in columnSubDetailList1" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed == ''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="right"
min-width="80"
label="单位用量">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" :ref="`qtyPerAssembly${scope.$index}`" v-model="scope.row.qtyPerAssembly" @keyup.enter.native="focusNextInput(scope.$index, 'qtyPerAssembly')" style="height: 11px; width: 98%"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="right"
min-width="80"
label="调机量">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" :ref="`componentScrap${scope.$index}`" v-model="scope.row.componentScrap" @keyup.enter.native="focusNextInput(scope.$index, 'componentScrap')" style="height: 11px; width: 98%"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="right"
min-width="80"
label="损耗率">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" :ref="`shrinkageFactor${scope.$index}`" v-model="scope.row.shrinkageFactor" @keyup.enter.native="focusNextInput(scope.$index, 'shrinkageFactor')" style="height: 11px; width: 98%"></el-input-number>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnSubDetailList2" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed == ''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="100"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="updateComponentModal(scope.row)">编辑</el-link>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
<el-footer style="height:15px;margin-top:15px;text-align:center">
<el-button :loading="saveAllLoading" type="primary" @click="packageSaveData">应用</el-button>
</el-footer>
<!-- 子明细新增模态框 -->
<el-dialog title="子物料" :close-on-click-modal="false" top="25vh" v-drag :visible.sync="componentSaveModal" width="800px">
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item :label="'序号'" prop="lineSequence">
<el-input-number :controls="false" :step="0" v-model="componentData.lineSequence" style="width: 49px"></el-input-number>
</el-form-item>
<el-form-item prop="componentPart">
<span v-if="!componentDisableFlag" slot="label" @click="queryComponentPartModal"><a herf="#">子物料编码</a></span>
<span v-if="componentDisableFlag" slot="label">子物料编码</span>
<el-input v-model="componentData.componentPart" :disabled="componentDisableFlag" @blur="componentPartBlur" style="width: 130px"></el-input>
</el-form-item>
<el-form-item :label="'子物料名称'">
<el-input v-model="componentData.componentPartDesc" disabled style="width: 249px"></el-input>
</el-form-item>
<el-form-item :label="'物料单位'">
<el-input v-model="componentData.printUnitName" disabled style="width: 110px"></el-input>
</el-form-item>
<el-form-item :label="'消耗项目'" prop="consumptionItem">
<el-select v-model="componentData.consumptionItem" style="width: 167px">
<el-option label="Consumed" value="Consumed"></el-option>
<el-option label="Not Consumed" value="Not Consumed"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item :label="'单位用量'" prop="qtyPerAssembly">
<el-input-number :controls="false" :step="0" v-model="componentData.qtyPerAssembly" style="width: 144px"></el-input-number>
</el-form-item>
<el-form-item :label="'调机量'" prop="componentScrap">
<el-input-number :controls="false" :step="0" v-model="componentData.componentScrap" style="width: 80px"></el-input-number>
</el-form-item>
<el-form-item :label="'损耗率%'" prop="shrinkageFactor">
<el-input-number :controls="false" :step="0" min="0" max="100" v-model="componentData.shrinkageFactor" style="width: 80px"></el-input-number>
</el-form-item>
<el-form-item>
<span slot="label" @click="queryOperationList"><a>工序</a></span>
<el-input v-model="componentData.operationNo" readonly style="width: 110px"></el-input>
</el-form-item>
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(215)"><a herf="#">发料库位</a></span>
<el-input v-model="componentData.issueToLocName" readonly style="width: 110px"></el-input>
</el-form-item>
<el-form-item :label="'生产属性'" prop="issueType">
<el-select v-model="componentData.issueType" style="width: 167px">
<el-option label="Reserve And Backflush" value="Reserve And Backflush"></el-option>
<el-option label="Reserve" value="Reserve"></el-option>
<el-option label="Backflush" value="Backflush"></el-option>
<el-option label="Manual" value="Manual"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item :label="'实际生产数量'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.productionData" :disabled="!productionDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'材料数量'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialData" :disabled="!materialDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'成品数量'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.finishedProductData" :disabled="!finishedProductDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'用量损耗'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.consumptionLoss" :disabled="!consumptionLossFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item :label="'涂胶长度'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.coatingLength" :disabled="!coatingLengthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'胶水克重'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.glueWeight" :disabled="!glueWeightFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'材料宽度'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialWidth" :disabled="!materialWidthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'宽度换算单位'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.widthConversion" :disabled="!widthConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item :label="'材料长度1'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialLength" :disabled="!materialLengthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'材料厚度'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialThickness" :disabled="!materialThicknessFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'面积单位换算'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.areaConversion" :disabled="!areaConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'密度单位换算'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.densityConversion" :disabled="!densityConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item :label="'材料克重'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialWeight" :disabled="!materialWeightFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'材料长度2'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialLength2" :disabled="!materialLength2Family.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
<el-form-item :label="'单位换算'">
<el-input-number :controls="false" :step="0" min="0" v-model="componentData.unitConversion" :disabled="!unitConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item label="备注">
<el-input type="textarea" v-model="componentData.noteText" :rows="3" resize='none' show-word-limit style="width: 759px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;margin-top:65px;text-align:center">
<el-button :loading="computeLoading" type="primary" @click="computeQtyPerAssembly()">计算</el-button>
<el-button v-if="componentData.flag === '1'" type="primary" @click="componentDataSave(true)">应用</el-button>
<el-button type="primary" @click="componentDataSave(false)">保存</el-button>
<el-button type="primary" @click="componentSaveModal = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 子明细物料模态框 -->
<el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="700px">
<el-form :inline="true" label-position="top" :model="componentPartData">
<el-form-item :label="'物料编码'">
<el-input v-model="componentPartData.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'">
<el-input v-model="componentPartData.partDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryComponentPartList">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="250"
:data="componentPartList"
@row-dblclick="getComponentRowData"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in componentPartColumnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
<el-pagination
@size-change="sizeChangeHandle3"
@current-change="currentChangeHandle3"
:current-page="pageIndex3"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize3"
:total="totalPage3"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-footer style="height:35px;margin-top:10px;text-align:center">
<el-button type="primary" @click="componentPartModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 批量新增 -->
<el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="batchComponentPartModelFlag" width="1170px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="batchComponentPartData">
<el-form-item :label="'物料编码'">
<el-input v-model="batchComponentPartData.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'">
<el-input v-model="batchComponentPartData.partDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryBatchComponentPartList">查询</el-button>
</el-form-item>
<el-form-item :label="'损耗率%'" style="margin-left: 725px">
<el-input-number :controls="false" :step="0" min="0" max="100" v-model="batchComponentPartData.shrinkageFactor" style="width: 80px"></el-input-number>
</el-form-item>
</el-form>
</div>
<el-container>
<el-main style="width: 770px; padding: 1px">
<span style="font-size: 12px" >可选物料</span>
<el-table
height="400px"
:data="batchComponentPartList"
border
ref="batchSaveTable"
@row-dblclick="batchAddPartDB"
@selection-change="selectionSaveComponent"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in componentPartColumnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
<el-pagination
@size-change="sizeChangeHandle5"
@current-change="currentChangeHandle5"
:current-page="pageIndex5"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize5"
:total="totalPage5"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-main>
<el-main style="width: 111px;padding: -1px">
<div style="margin-top: 182px;margin-left: 5px">
<el-button type="primary" @click="batchAddPart">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 5px">
<el-button type="primary" @click="batchDeletePart">删除<<</el-button>
</div>
</el-main>
<el-main style="width: 400px;padding: 1px">
<span style="font-size: 12px" >已选物料</span>
<el-table
height="400px"
:data="choosePartList"
border
ref="batchSaveTable2"
@row-dblclick="batchDeletePartDB"
@selection-change="selectionSaveComponent2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="partNo"
header-align="center"
align="center"
min-width="100"
label="物料编码">
</el-table-column>
<el-table-column
prop="partDesc"
header-align="center"
align="center"
min-width="190"
label="物料名称">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="batchComponentDataSave">保存</el-button>
<el-button type="primary" @click="batchComponentPartModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 明细新增模态框 -->
<el-dialog title="替代" :close-on-click-modal="false" v-drag :visible.sync="saveDetailModalFlag" width="530px">
<el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
<el-form-item :label="'替代编码'" prop="alternativeNo">
<el-input v-model="saveDetailData.alternativeNo" :disabled="saveDetailModalDisable" style="width: 235px"></el-input>
</el-form-item>
<el-form-item :label="'替代名称'" prop="alternativeDescription">
<el-input v-model="saveDetailData.alternativeDescription" style="width: 235px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
<el-form-item :label="'状态'" prop="status">
<el-input v-model="saveDetailData.status" disabled style="width: 235px"></el-input>
</el-form-item>
<el-form-item :label="'最小订单数'" prop="minLotQty">
<el-input-number :controls="false" :step="0" v-model="saveDetailData.minLotQty" style="width: 235px"></el-input-number>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="saveDetailData" style="margin-left: 5px">
<el-form-item label="备注">
<el-input type="textarea" v-model="saveDetailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 500px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;margin-top:65px;text-align:center">
<el-button :loading="saveDetailLoading" type="primary" @click="detailDataSave">保存</el-button>
<el-button type="primary" @click="saveDetailModalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 工序 -->
<el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="700px">
<div class="rq">
<el-form :inline="true" label-position="top" :model="operationData">
<el-form-item label="Routing版本号">
<el-input v-model="operationData.routingRevision" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="工艺类型">
<el-select v-model="operationData.routingType" clearable style="width: 120px">
<el-option label="Manufacturing" value="Manufacturing"></el-option>
<el-option label="Repair" value="Repair"></el-option>
<el-option label="Prototype" value="Prototype"></el-option>
</el-select>
</el-form-item>
<el-form-item label="替代编码">
<el-input v-model="operationData.alternativeNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="工序编码">
<el-input v-model="operationData.operationNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryOperationList">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="operationList"
@row-dblclick="getRowOperationData"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in operationDetailList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="operationModelFlag=false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 批量编辑工序 -->
<el-dialog title="工序" top="35vh" :close-on-click-modal="false" v-drag :visible.sync="batchOperationModelFlag" width="350px">
<el-form :inline="true" label-position="top" :model="batchOperationData" style="margin-left: 5px">
<el-form-item label="工序编码">
<span slot="label" @click="queryOperationList"><a>工序</a></span>
<el-input v-model="batchOperationData.operationNo" style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="工序名称">
<el-input v-model="batchOperationData.operationName" disabled style="width: 200px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;margin-top:20px;text-align:center">
<el-button type="primary" @click="batchOperationEdit">保存</el-button>
<el-button type="primary" @click="batchOperationModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 导入 -->
<bom-component-upload ref="BomComponentUpload" @refreshPageTables="queryBomComponentTable" v-drag></bom-component-upload>
<!-- chooseList模态框 -->
<ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
</div>
</template>
<script>
import {
getBomInformationByPartNo,
saveBomHeader, // 新增bom主信息
} from "@/api/part/quicklyCreateBom.js"
import {
bomManagementSave, // bom新增
queryBomHeader, // 查询bom主信息
queryBomDetail, // 查bom明细
bomDetailSave, // bom明细新增
bomDetailUpdate, // bom明细编辑
updateAlternativeStatus, // 修改明细状态
queryBomComponent, // 查询bom子明细
saveBomComponent, // 新增bom子明细
updateBomComponent, // 修改bom子明细
deleteBomComponent, // 删除bom子明细
queryOperationList, // 根据物料编码查询工序
getComponentLineSequence, // 获取子料的序号
queryBomComponentTable, // 刷新子物料
queryPartListAll, // 查询包含Purchase(Raw)的物料
batchSaveBomComponent, // 批量新增子件
computeQtyPerAssemblySave, // 计算单位用量(新增)
computeQtyPerAssemblyEdit, // 计算单位用量(修改)
batchOperationEdit, // 批量修改工序
} from "@/api/part/bomManagement.js"
import ChooseList from '@/views/modules/common/Chooselist_eam'
import {Decimal} from "decimal.js"
import BomComponentUpload from "./bom_component_upload.vue"
export default {
components: {
BomComponentUpload,
ChooseList
},
name: 'bomCreate',
data() {
return {
// 初始页签
detailTable: 'bom_detail',
subDetailTable: 'bom_sub_detail',
pageIndex3: 1,
pageSize3: 20,
totalPage3: 0,
pageIndex5: 1,
pageSize5: 20,
totalPage5: 0,
batchComponentSelections: [],
batchComponentSelections2: [],
checkedDetail: [],
detailDataList: [],
subDetailList: [],
componentPartList: [],
batchComponentPartList: [],
choosePartList: [],
operationList: [],
modalData: {
flag: '',
title: '',
site: '',
buNo: '',
partNo: '',
partDesc: '',
engChgLevel: undefined,
bomType: '',
noteText: '',
effPhaseInDate: '',
effPhaseOutDate: '',
engRevision: '',
typeFlag: '',
netWeight: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: '',
printUnit: '',
printUnitName: '',
yieldRate: '',
shrinkageFactor: '',
processUnit: '',
processUnitName: ''
},
detailData: {
site: this.$store.state.user.site,
partNo: '',
engChgLevel: '',
bomType: '',
alternativeNo: '',
alternativeDescription: '',
minLotQty: '',
defaultFlag: '',
detailNoteText: '',
status: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: '',
},
componentData: {
flag: '',
site: this.$store.state.user.site,
partNo: '',
engChgLevel: '',
bomType: '',
alternativeNo: '',
componentPart: '',
componentPartDesc: '',
printUnit: '',
printUnitName: '',
qtyPerAssembly: '',
componentScrap: '',
issueType: '',
shrinkageFactor: '',
lineItemNo: '',
operationId: '',
operationNo: '',
issueToLoc: '',
issueToLocName: '',
noteText: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: '',
lineSequence: '',
consumptionItem: '',
productFlag: '',
familyID: '',
productionData: undefined,
materialData: undefined,
finishedProductData: undefined,
consumptionLoss: undefined,
coatingLength: undefined,
glueWeight: undefined,
materialWidth: undefined,
widthConversion: undefined,
materialLength: undefined,
materialThickness: undefined,
areaConversion: undefined,
densityConversion: undefined,
materialWeight: undefined,
materialLength2: undefined,
unitConversion: undefined
},
componentPartData: {
site: '',
buNo: '',
partNo: '',
partDesc: '',
page: 1,
limit: 10
},
batchComponentPartData: {
site: '',
buNo: '',
partNo: '',
partDesc: '',
shrinkageFactor: '',
page: 1,
limit: 10
},
saveDetailData: {
flag: '',
site: this.$store.state.user.site,
partNo: '',
engChgLevel: '',
bomType: '',
alternativeNo: '',
alternativeDescription: '',
minLotQty: '',
defaultFlag: '',
detailNoteText: '',
status: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: '',
},
operationData: {
site: '',
buNo: '',
partNo: '',
routingRevision: '',
routingType: '',
alternativeNo: '',
operationNo: '',
operationName: '',
},
batchOperationData: {
operationId: '',
operationNo: '',
operationName: ''
},
// 必填规则
rules: {
partNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
partDesc: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
bomType: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
effPhaseInDate: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
engChgLevel: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
processUnit: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
]
},
componentRules: {
componentPart: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
lineSequence: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
qtyPerAssembly: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
componentScrap: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
shrinkageFactor: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
issueType: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
consumptionItem: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
]
},
detailRules: {
alternativeNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
alternativeDescription: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
minLotQty: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
status: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
]
},
columnList: [
{
columnProp: 'nodeId',
headerAlign: "center",
align: "left",
columnLabel: '节点编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth : 100,
},
{
columnProp: 'nodeName',
headerAlign: "center",
align: "left",
columnLabel: '节点名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth : 200,
},
{
columnProp: 'createDate',
headerAlign: "center",
align: "center",
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth : 150,
},
{
columnProp: 'createBy',
headerAlign: "center",
align: "left",
columnLabel: '创建人',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth : 100,
},
{
columnProp: 'updateDate',
headerAlign: "center",
align: "center",
columnLabel: '更新时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth : 150,
},
{
columnProp: 'updateBy',
headerAlign: "center",
align: "left",
columnLabel: '更新人',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth : 100,
},
],
partColumnList: [
{
columnProp: 'partNo',
headerAlign: "center",
align: "center",
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
columnProp: 'partDesc',
headerAlign: "center",
align: "center",
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 300
},
{
columnProp: 'spec',
headerAlign: "center",
align: "center",
columnLabel: '规格型号',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 300
},
{
columnProp: 'printUnitName',
headerAlign: "center",
align: "center",
columnLabel: '计量单位',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
{
columnProp: 'partType2',
headerAlign: "center",
align: "center",
columnLabel: '零件类型',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
{
columnProp: 'yieldRate',
headerAlign: "center",
align: "right",
columnLabel: '良品率',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
],
columnSubDetailList1: [
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2LineSequence',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'lineSequence',
headerAlign: 'center',
align: 'center',
columnLabel: '序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 50
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2ComponentPart',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'componentPart',
headerAlign: 'center',
align: 'left',
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2ComponentPartDesc',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'componentPartDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2PrintUnit',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'printUnitName',
headerAlign: 'center',
align: 'center',
columnLabel: '物料单位',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},
],
columnSubDetailList2: [
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2ConsumptionItem',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'consumptionItem',
headerAlign: 'center',
align: 'center',
columnLabel: '消耗项目',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2IssueType',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'issueType',
headerAlign: 'center',
align: 'center',
columnLabel: '生产属性',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 140
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2OperationNo',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'operationNo',
headerAlign: 'center',
align: 'center',
columnLabel: '工序编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2OperationName',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'operationName',
headerAlign: 'center',
align: 'left',
columnLabel: '工序名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2IssueToLoc',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'issueToLocName',
headerAlign: 'center',
align: 'center',
columnLabel: '发料库位',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 601002,
serialNumber: '601002Table2NoteText',
tableId: '601002Table2',
tableName: 'BOM子物料表',
columnProp: 'noteText',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
],
componentPartColumnList: [
{
columnProp: 'partNo',
headerAlign: "center",
align: "center",
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 120
},
{
columnProp: 'partDesc',
headerAlign: "center",
align: "center",
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 300
},
{
columnProp: 'spec',
headerAlign: "center",
align: "center",
columnLabel: '规格型号',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 300
},
{
columnProp: 'printUnitName',
headerAlign: "center",
align: "center",
columnLabel: '计量单位',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
{
columnProp: 'partType2',
headerAlign: "center",
align: "center",
columnLabel: '零件类型',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
}
],
operationDetailList: [
{
columnProp: 'routingRevision',
headerAlign: "center",
align: "center",
columnLabel: 'Routing版本号',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
{
columnProp: 'routingType',
headerAlign: "center",
align: "center",
columnLabel: '工艺类型',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
{
columnProp: 'alternativeNo',
headerAlign: "center",
align: "center",
columnLabel: '替代编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 80
},
{
columnProp: 'alternativeDescription',
headerAlign: "center",
align: "center",
columnLabel: '替代名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
},
{
columnProp: 'status',
headerAlign: "center",
align: "center",
columnLabel: '替代状态',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 80
},
{
columnProp: 'operationNo',
headerAlign: "center",
align: "center",
columnLabel: '工序编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 80
},
{
columnProp: 'operationName',
headerAlign: "center",
align: "center",
columnLabel: '工序名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100
}
],
// loading
saveHeaderLoading: false,
alternativeLoading: false,
saveAllLoading: false,
saveDetailLoading: false,
computeLoading: false,
// 控制
modalFlag: false,
modalDisableFlag: false,
authSearch: false,
authSave: false,
authUpdate: false,
authDelete: false,
headerSaveFlag: false,
componentDisableFlag: false,
componentSaveModal: false,
componentPartModelFlag: false,
batchComponentPartModelFlag: false,
saveDetailModalFlag :false,
saveDetailModalDisable: false,
operationModelFlag: false,
batchOperationModelFlag: false,
// ======== 子物料字段分类集合 ========
productionDataFamily: ['RFID003', 'RFID004', 'RFID005', 'RFID006', 'RFID007', 'RFID008', 'RFID009', 'RFID012', 'RFID023', 'RFID024', 'RFID025', 'RFID026', 'RFID027'],
materialDataFamily: ['RFID011', 'RFID020', 'RFID021', 'RFID022'],
finishedProductDataFamily: ['RFID020', 'RFID021', 'RFID022'],
consumptionLossFamily: ['RFID001', 'RFID002', 'RFID011', 'RFID014', 'RFID015', 'RFID016', 'RFID017', 'RFID018', 'RFID019'],
coatingLengthFamily: ['RFID013'],
glueWeightFamily: ['RFID013'],
materialWidthFamily: ['RFID014', 'RFID015'],
widthConversionFamily: ['RFID014', 'RFID015'],
materialLengthFamily: ['RFID016', 'RFID017'],
materialThicknessFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
areaConversionFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
densityConversionFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
materialWeightFamily: ['RFID018', 'RFID019'],
materialLength2Family: ['RFID018', 'RFID019'],
unitConversionFamily: ['RFID018', 'RFID019'],
}
},
methods: {
// 初始化组件的参数
init (tempData) {
getBomInformationByPartNo(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.rows.partNo != null && data.rows.partNo.length > 0) {
this.updateModal(data.rows)
} else {
this.addModal(tempData)
}
if (tempData.offFlag === '1') {
this.$emit('refreshNode', tempData.partNo)
}
} else {
this.$alert(data.msg, '提示', {
confirmButtonText: '确定'
})
}
})
},
// 初始化组件的参数
init2 () {
this.modalData = {}
this.detailDataList = []
this.subDetailList = []
this.detailData = {}
},
// 每页数
sizeChangeHandle3 (val) {
this.pageSize3 = val
this.pageIndex3 = 1
this.queryComponentPartModal()
},
// 当前页
currentChangeHandle3 (val) {
this.pageIndex3 = val
this.queryComponentPartModal()
},
// 每页数
sizeChangeHandle5 (val) {
this.pageSize5 = val
this.pageIndex5 = 1
this.queryBatchComponentPartList()
},
// 当前页
currentChangeHandle5 (val) {
this.pageIndex5 = val
this.queryBatchComponentPartList()
},
// bom新增模态框
addModal (row) {
this.modalData = {
flag: '1',
title: 'bom新增',
site: row.site,
buNo: row.buNo,
partNo: row.partNo,
partDesc: row.partDesc,
engChgLevel: 1,
bomType: row.bomType,
noteText: '',
effPhaseInDate: new Date(+ new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''),
effPhaseOutDate: '',
engRevision: '',
typeFlag: 'B',
netWeight: '',
createBy: this.$store.state.user.name,
printUnit: row.printUnit,
printUnitName: row.printUnitName,
yieldRate: '',
shrinkageFactor: row.shrinkageFactor,
processUnit: row.printUnit,
processUnitName: row.printUnitName
}
this.detailData = {
site: row.site,
buNo: row.buNo,
partNo: '',
engChgLevel: '',
bomType: '',
alternativeNo: '',
alternativeDescription: '',
minLotQty: '',
defaultFlag: '',
detailNoteText: '',
status: '',
createDate: '',
createBy: this.$store.state.user.name,
updateDate: '',
updateBy: this.$store.state.user.name,
}
this.detailDataList = []
this.subDetailList = []
this.headerSaveFlag = true
this.modalDisableFlag = false
this.$emit('refreshBomLoading')
},
// bom编辑模态框
async updateModal (row) {
this.modalData = {
flag: '2',
site: row.site,
buNo: row.buNo,
partNo: row.partNo,
partDesc: row.partDesc,
engChgLevel: row.engChgLevel,
bomType: row.bomType,
noteText: row.noteText,
effPhaseInDate: row.effPhaseInDate,
effPhaseOutDate: row.effPhaseOutDate,
engRevision: row.engRevision,
typeFlag: row.typeFlag,
netWeight: row.netWeight,
updateBy: this.$store.state.user.name,
printUnit: row.printUnit,
printUnitName: row.printUnitName,
alternativeNo: row.alternativeNo,
yieldRate: row.yieldRate,
shrinkageFactor: new Decimal(100).sub(new Decimal(row.yieldRate)).toNumber(),
processUnit: row.processUnit,
processUnitName: row.processUnitName
}
this.subDetailTable = 'bom_sub_detail'
// 查bom明细
queryBomDetail(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailList
this.subDetailList = data.rows.componentList
this.detailData = data.rows.detailData
this.modalDisableFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.$emit('refreshBomLoading')
}).catch(() => {
this.$emit('refreshBomLoading')
})
},
// 保存主表信息
saveBomHeader () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请先选择Bom物料!')
return
}
if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
this.$message.warning('请先填写Bom版本号!')
return
}
if (this.modalData.bomType === '' || this.modalData.bomType == null) {
this.$message.warning('请先选择制造类型!')
return
}
if (this.modalData.processUnit === '' || this.modalData.processUnit == null) {
this.$message.warning('请先选择工序单位!')
return
}
this.saveHeaderLoading = true
// 新增主表信息
saveBomHeader(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.modalData = {
flag: '1',
title: 'bom新增',
bu: data.rows.modalData.site + '_' + data.rows.modalData.buNo,
site: data.rows.modalData.site,
buNo: data.rows.modalData.buNo,
partNo: data.rows.modalData.partNo,
partDesc: data.rows.modalData.partDesc,
engChgLevel: data.rows.modalData.engChgLevel,
bomType: data.rows.modalData.bomType,
noteText: data.rows.modalData.noteText,
effPhaseInDate: data.rows.modalData.effPhaseInDate,
effPhaseOutDate: data.rows.modalData.effPhaseOutDate,
engRevision: data.rows.modalData.engRevision,
typeFlag: data.rows.modalData.typeFlag,
netWeight: data.rows.modalData.netWeight,
yieldRate: data.rows.modalData.yieldRate,
printUnit: data.rows.modalData.printUnit,
printUnitName: data.rows.modalData.printUnitName,
shrinkageFactor: new Decimal(100).sub(new Decimal(data.rows.modalData.yieldRate)).toNumber(),
processUnit: data.rows.modalData.processUnit,
processUnitName: data.rows.modalData.processUnitName
}
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = []
this.modalDisableFlag = true
this.headerSaveFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveHeaderLoading = false
})
},
// 替代编辑模态框
updateBomDetail () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请先选择Bom物料!')
return
}
if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
this.$message.warning('请先填写Bom版本号!')
return
}
if (this.modalData.bomType === '' || this.modalData.bomType == null) {
this.$message.warning('请先选择制造类型!')
return
}
this.saveDetailData = {
flag: '2',
site: this.detailData.site,
buNo: this.detailData.buNo,
partNo: this.detailData.partNo,
engChgLevel: this.detailData.engChgLevel,
bomType: this.detailData.bomType,
alternativeNo: this.detailData.alternativeNo,
alternativeDescription: this.detailData.alternativeDescription,
minLotQty: this.detailData.minLotQty,
defaultFlag: '',
detailNoteText: this.detailData.detailNoteText,
status: this.detailData.status,
updateBy: this.$store.state.user.name,
}
// 查询bom主信息
queryBomHeader(this.modalData).then(({data}) => {
if (data && data.code === 0) {
if (data.rows.length > 0) {
this.saveDetailModalFlag = true
this.saveDetailModalDisable = true
} else {
this.$message.warning('请先保存BOM主记录!')
}
} else {
this.$alert(data.msg, '提示', {
confirmButtonText: '确定'
})
}
})
},
// 替代改变事件
alternativeChange () {
this.alternativeLoading = true
queryBomComponent(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.alternativeLoading = false
}).catch(()=>{
this.alternativeLoading = false
})
},
// 修改替代状态为 Buildable
updateStatusToBuildable () {
this.$confirm(`是否修改状态为Buildable?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateAlternativeStatus(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
// 刷新替代和子明细
this.alternativeChange()
}
})
})
},
// 修改替代状态为 Obsolete
updateStatusToObsolete () {
this.$confirm(`是否修改状态为Obsolete?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateAlternativeStatus(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
// 刷新替代和子明细
this.alternativeChange()
}
})
})
},
// 刷新方法
queryBomComponentTable () {
queryBomComponentTable(this.detailData).then(({data}) => {
if (data.code === 0) {
this.subDetailList = data.rows
}
})
},
// 子明细新增模态框
saveComponentModal () {
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请先选择替代!')
return
}
this.componentData = {
flag: '1',
site: this.modalData.site,
buNo: this.modalData.buNo,
partNo: this.modalData.partNo,
engChgLevel: this.modalData.engChgLevel,
bomType: this.modalData.bomType,
alternativeNo: this.detailData.alternativeNo,
componentPart: '',
componentPartDesc: '',
printUnit: '',
printUnitName: '',
qtyPerAssembly: 0,
componentScrap: 0,
issueType: 'Reserve And Backflush',
shrinkageFactor: this.modalData.shrinkageFactor,
lineItemNo: '',
operationId: '',
operationNo: '',
issueToLoc: '',
issueToLocName: '',
noteText: '',
createBy: this.$store.state.user.name,
lineSequence: '',
consumptionItem: 'Consumed',
productFlag: 'component',
familyID: '',
productionData: undefined,
materialData: undefined,
finishedProductData: undefined,
consumptionLoss: undefined,
coatingLength: undefined,
glueWeight: undefined,
materialWidth: undefined,
widthConversion: undefined,
materialLength: undefined,
materialThickness: undefined,
areaConversion: undefined,
densityConversion: undefined,
materialWeight: undefined,
materialLength2: undefined,
unitConversion: undefined
}
// 获取子料的序号
getComponentLineSequence(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.componentData.lineSequence = data.lineSequence
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
this.componentDisableFlag = false
this.componentSaveModal = true
},
// 批量新增子物料模态框
batchSaveComponentModal () {
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请先选择替代!')
return
}
this.pageSize5 = 20
this.pageIndex5 = 1
this.batchComponentPartData.partNo = ''
this.batchComponentPartData.partDesc = ''
this.batchComponentPartData.limit = this.pageSize5
this.batchComponentPartData.page = this.pageIndex5
this.batchComponentPartData.site = this.modalData.site
this.batchComponentPartData.buNo = this.modalData.buNo
// 查询所有物料
queryPartListAll(this.batchComponentPartData).then(({data}) => {
if (data && data.code === 0) {
this.batchComponentPartList = data.page.list
this.pageIndex5 = data.page.currPage
this.pageSize5 = data.page.pageSize
this.totalPage5 = data.page.totalCount
this.batchComponentPartModelFlag = true
} else {
this.batchComponentPartList = []
}
})
this.batchComponentPartData.shrinkageFactor = this.modalData.shrinkageFactor
this.choosePartList = []
},
// 子物料批量导入
bomComponentUpload () {
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请先选择替代!')
return
}
let currentData = {
site: this.detailData.site,
buNo: this.detailData.buNo,
partNo: this.detailData.partNo,
engChgLevel: this.detailData.engChgLevel,
bomType: this.detailData.bomType,
alternativeNo: this.detailData.alternativeNo,
createBy: this.$store.state.user.name,
shrinkageFactor: this.modalData.shrinkageFactor
}
//打开组件 去做新增业务
this.$nextTick(() => {
this.$refs.BomComponentUpload.init(currentData)
})
},
// 删除子物料
deleteComponentPart () {
if (this.checkedDetail.length === 0) {
this.$message.warning('请选择要删除子物料!')
return
} else {
this.$confirm("请是否确认删除该子明细记录?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let tempData = {
informationList: this.checkedDetail,
productFlag: 'component'
}
deleteBomComponent(tempData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
})
}
},
// 选中数据
componentSelectionChange(selection) {
this.checkedDetail = selection
},
// 子明细编辑模态框
updateComponentModal (row) {
this.componentData = {
flag: '2',
site: row.site,
buNo: row.buNo,
partNo: row.partNo,
engChgLevel: row.engChgLevel,
bomType: row.bomType,
alternativeNo: row.alternativeNo,
componentPart: row.componentPart,
componentPartDesc: row.componentPartDesc,
printUnit: row.printUnit,
printUnitName: row.printUnitName,
qtyPerAssembly: row.qtyPerAssembly,
componentScrap: row.componentScrap,
issueType: row.issueType,
shrinkageFactor: row.shrinkageFactor,
lineItemNo: row.lineItemNo,
operationId: row.operationId,
operationNo: row.operationNo,
issueToLoc: row.issueToLoc,
issueToLocName: row.issueToLocName,
noteText: row.noteText,
updateBy: this.$store.state.user.name,
lineSequence: row.lineSequence,
consumptionItem: row.consumptionItem,
productFlag: 'component',
familyID: row.familyID,
productionData: row.productionData == null ? undefined : row.productionData,
materialData: row.materialData == null ? undefined : row.materialData,
finishedProductData: row.finishedProductData == null ? undefined : row.finishedProductData,
consumptionLoss: row.consumptionLoss == null ? undefined : row.consumptionLoss,
coatingLength: row.coatingLength == null ? undefined : row.coatingLength,
glueWeight: row.glueWeight == null ? undefined : row.glueWeight,
materialWidth: row.materialWidth == null ? undefined : row.materialWidth,
widthConversion: row.widthConversion == null ? undefined : row.widthConversion,
materialLength: row.materialLength == null ? undefined : row.materialLength,
materialThickness: row.materialThickness == null ? undefined : row.materialThickness,
areaConversion: row.areaConversion == null ? undefined : row.areaConversion,
densityConversion: row.densityConversion == null ? undefined : row.densityConversion,
materialWeight: row.materialWeight == null ? undefined : row.materialWeight,
materialLength2: row.materialLength2 == null ? undefined : row.materialLength2,
unitConversion: row.unitConversion == null ? undefined : row.unitConversion,
}
this.componentDisableFlag = true
this.componentSaveModal = true
},
// 判断子物料工序是否选择
packageSaveData () {
const allAHasValue = this.subDetailList.every(item => item.operationId !== null && item.operationId !== '')
if (!allAHasValue) {
this.$confirm(`存在未选择工序的子物料,是否确认保存数据?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.saveData()
})
} else {
this.saveData()
}
},
// bom新增/编辑
saveData () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请选择物料编码!')
return
}
if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
this.$message.warning('请选择物料名称!')
return
}
if (this.modalData.bomType === '' || this.modalData.bomType == null) {
this.$message.warning('请选择制造类型!')
return
}
if (this.modalData.effPhaseInDate === '' || this.modalData.effPhaseInDate == null) {
this.$message.warning('请选择生效日期!')
return
}
if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
this.$message.warning('请填写BOM版本号!')
return
}
if (this.modalData.processUnit === '' || this.modalData.processUnit == null) {
this.$message.warning('请选择工序单位!')
return
}
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请选择替代!')
return
}
if (this.detailData.status === '' || this.detailData.status == null) {
this.$message.warning('请选择替代状态!')
return
}
let tempData = {
site: this.modalData.site,
buNo: this.modalData.buNo,
partNo: this.modalData.partNo,
partDesc: this.modalData.partDesc,
engChgLevel: this.modalData.engChgLevel,
bomType: this.modalData.bomType,
noteText: this.modalData.noteText,
effPhaseInDate: this.modalData.effPhaseInDate,
effPhaseOutDate: this.modalData.effPhaseOutDate,
engRevision: this.modalData.engRevision,
typeFlag: this.modalData.typeFlag,
netWeight: this.modalData.netWeight,
alternativeNo: this.detailData.alternativeNo,
alternativeDescription: this.detailData.alternativeDescription,
minLotQty: this.detailData.minLotQty,
defaultFlag: this.detailData.defaultFlag,
detailNoteText: this.detailData.detailNoteText,
status: this.detailData.status,
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
informationList: this.subDetailList,
processUnit: this.modalData.processUnit
}
this.saveAllLoading = true
bomManagementSave(tempData).then(({data}) => {
if (data && data.code === 0) {
this.updateModal(data.rows)
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveAllLoading = false
}).catch(() => {
this.saveAllLoading = false
})
},
// 子物料列表
queryComponentPartModal () {
this.componentPartData.limit = this.pageSize3
this.componentPartData.page = this.pageIndex3
this.componentPartData.site = this.modalData.site
this.componentPartData.buNo = this.modalData.buNo
// 查询所有物料
queryPartListAll(this.componentPartData).then(({data}) => {
if (data && data.code === 0) {
this.componentPartList = data.page.list
this.pageIndex3 = data.page.currPage
this.pageSize3 = data.page.pageSize
this.totalPage3 = data.page.totalCount
this.componentPartModelFlag = true
} else {
this.componentPartList = []
}
})
},
// 子物料查询列表
queryComponentPartList () {
this.componentPartData.limit = this.pageSize3
this.componentPartData.page = this.pageIndex3
// 查询所有物料
queryPartListAll(this.componentPartData).then(({data}) => {
if (data && data.code === 0) {
this.componentPartList = data.page.list
this.pageIndex3 = data.page.currPage
this.pageSize3 = data.page.pageSize
this.totalPage3 = data.page.totalCount
} else {
this.componentPartList = []
}
})
},
// 双击选中子物料
getComponentRowData (row) {
this.componentData.componentPart = row.partNo
this.componentData.componentPartDesc = row.partDesc
this.componentData.printUnit = row.printUnit
this.componentData.printUnitName = row.printUnitName
this.componentData.familyID = row.familyID
if (this.widthConversionFamily.includes(row.familyID)) {
this.componentData.widthConversion = 1
} else if (this.areaConversionFamily.includes(row.familyID)) {
this.componentData.areaConversion = 1
} else if (this.densityConversionFamily.includes(row.familyID)) {
this.componentData.densityConversion = 1
} else if (this.unitConversionFamily.includes(row.familyID)) {
this.componentData.unitConversion = 1
} else if (this.consumptionLossFamily.includes(row.familyID)) {
this.componentData.consumptionLoss = 1
}
this.componentPartModelFlag = false
},
// 子物料编码失焦事件
componentPartBlur () {
if (this.componentData.componentPart != null && this.componentData.componentPart !== '') {
this.componentPartData.limit = this.pageSize3
this.componentPartData.page = this.pageIndex3
this.componentPartData.site = this.modalData.site
this.componentPartData.buNo = this.modalData.buNo
this.componentPartData.partNo = this.componentData.componentPart
queryPartListAll(this.componentPartData).then(({data}) => {
if (data && data.code === 0) {
if (data.page.list.length > 0) {
this.componentData.componentPartDesc = data.page.list[0].partDesc
this.componentData.printUnit = data.page.list[0].printUnit
this.componentData.printUnitName = data.page.list[0].printUnitName
this.componentData.familyID = data.page.list[0].familyID
if (this.widthConversionFamily.includes(data.page.list[0].familyID)) {
this.componentData.widthConversion = 1
} else if (this.areaConversionFamily.includes(data.page.list[0].familyID)) {
this.componentData.areaConversion = 1
} else if (this.densityConversionFamily.includes(data.page.list[0].familyID)) {
this.componentData.densityConversion = 1
} else if (this.unitConversionFamily.includes(data.page.list[0].familyID)) {
this.componentData.unitConversion = 1
} else if (this.consumptionLossFamily.includes(data.page.list[0].familyID)) {
this.componentData.consumptionLoss = 1
}
return
}
}
})
}
this.componentData.componentPartDesc = ''
this.componentData.printUnit = ''
this.componentData.printUnitName = ''
this.componentData.familyID = ''
},
// 根据物料编码查询工序
queryOperationList () {
this.operationData.site = this.modalData.site
this.operationData.buNo = this.modalData.buNo
this.operationData.partNo = this.modalData.partNo
// 查询所有
queryOperationList(this.operationData).then(({data}) => {
if (data && data.code === 0) {
this.operationList = data.rows
this.operationData = {
site: this.modalData.site,
buNo: this.modalData.buNo,
partNo: this.modalData.partNo,
routingRevision: '',
routingType: '',
alternativeNo: '',
operationNo: '',
operationName: '',
}
this.operationModelFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 双击选中工序
getRowOperationData (row) {
if (this.batchOperationModelFlag) {
this.batchOperationData.operationId = row.operationId
this.batchOperationData.operationNo = row.operationNo
this.batchOperationData.operationName = row.operationName
} else {
this.componentData.operationId = row.operationId
this.componentData.operationNo = row.operationNo
}
this.operationModelFlag = false
},
// 新增子明细方法
componentDataSave (isClose) {
if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
this.$message.warning('序号不能为空!')
return
}
if (this.componentData.partNo === '' || this.componentData.partNo == null) {
this.$message.warning('请选择主记录物料编码!')
return
}
if (this.componentData.bomType === '' || this.componentData.bomType == null) {
this.$message.warning('请选择主记录制造类型!')
return
}
if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
this.$message.warning('请填写主记录BOM版本号!')
return
}
if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
this.$message.warning('请选择子物料编码!')
return
}
if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) {
this.$message.warning('请选择消耗项目!')
return
}
if (this.componentData.qtyPerAssembly === '' || this.componentData.qtyPerAssembly == null) {
this.$message.warning('请填写单位用量!')
return
}
if (this.componentData.qtyPerAssembly === 0) {
this.$message.warning('单位用量不能为0!')
return
}
if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
this.$message.warning('请填写调机量!')
return
}
if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
this.$message.warning('请填写损耗率!')
return
}
if (this.componentData.issueType === '' || this.componentData.issueType == null) {
this.$message.warning('请选择生产属性!')
return
}
if (this.componentData.flag === '1') {
saveBomComponent(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
if (isClose) {
if (this.subDetailTable === 'by_products') {
this.saveByProductModal()
} else {
this.saveComponentModal()
}
} else {
this.componentSaveModal = false
}
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
} else if (this.componentData.flag === '2') {
updateBomComponent(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
this.componentSaveModal = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}
},
// 计算单位用量
computeQtyPerAssembly () {
if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
this.$message.warning('序号不能为空!')
return
}
if (this.componentData.partNo === '' || this.componentData.partNo == null) {
this.$message.warning('请选择主记录物料编码!')
return
}
if (this.componentData.bomType === '' || this.componentData.bomType == null) {
this.$message.warning('请选择主记录制造类型!')
return
}
if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
this.$message.warning('请填写主记录BOM版本号!')
return
}
if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
this.$message.warning('请选择子物料编码!')
return
}
if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) {
this.$message.warning('请选择消耗项目!')
return
}
if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
this.$message.warning('请填写调机量!')
return
}
if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
this.$message.warning('请填写损耗率!')
return
}
if (this.componentData.issueType === '' || this.componentData.issueType == null) {
this.$message.warning('请选择生产属性!')
return
}
this.computeLoading = true
if (this.componentData.flag === '1') {
computeQtyPerAssemblySave(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
// 换成修改子物料模态框
this.updateComponentModal(data.rows.rowData)
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.computeLoading = false
}).catch(() => {
this.computeLoading = false
})
} else if (this.componentData.flag === '2') {
computeQtyPerAssemblyEdit(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
// 换成修改子物料模态框
this.updateComponentModal(data.rows.rowData)
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.computeLoading = false
}).catch(() => {
this.computeLoading = false
})
}
},
// 子物料查询列表
queryBatchComponentPartList () {
this.batchComponentPartData.limit = this.pageSize5
this.batchComponentPartData.page = this.pageIndex5
// 查询所有物料
queryPartListAll(this.batchComponentPartData).then(({data}) => {
if (data && data.code === 0) {
this.batchComponentPartList = data.page.list
this.pageIndex5 = data.page.currPage
this.pageSize5 = data.page.pageSize
this.totalPage5 = data.page.totalCount
} else {
this.batchComponentPartList = []
}
})
},
// 复选子物料信息
selectionSaveComponent (val) {
this.batchComponentSelections = val
},
// 复选子物料信息
selectionSaveComponent2 (val) {
this.batchComponentSelections2 = val
},
// 双击添加
batchAddPartDB (row) {
this.batchComponentSelections = []
this.batchComponentSelections.push(row)
this.batchAddPart()
},
// 双击删除
batchDeletePartDB (row) {
this.batchComponentSelections2 = []
this.batchComponentSelections2.push(row)
this.batchDeletePart()
},
batchAddPart () {
if (this.batchComponentSelections == null || this.batchComponentSelections.length === 0) {
this.$message.warning('请选择可选物料!')
return
}
// 创建一个 Set 来存储已选择的元素
const chosenSet = new Set(this.choosePartList.map(item => `${item.site}-${item.partNo}`))
// 检查是否有重复元素
const hasDuplicates = this.batchComponentSelections.some(item => chosenSet.has(`${item.site}-${item.partNo}`))
if (hasDuplicates) {
this.$message.warning('所选物料中包含已存在的物料,请重新选择!')
return
}
this.choosePartList = [...this.choosePartList, ...this.batchComponentSelections]
},
batchDeletePart () {
if (this.batchComponentSelections2 == null || this.batchComponentSelections2.length === 0) {
this.$message.warning('请选择已选物料!')
return
}
// 创建一个 Set 来存储 batchComponentSelections 中的键值对
const set = new Set(this.batchComponentSelections2.map(item => `${item.site}-${item.partNo}`))
// 过滤 choosePartList,移除与 batchComponentSelections 匹配的元素
this.choosePartList = this.choosePartList.filter(item => !set.has(`${item.site}-${item.partNo}`))
},
// 批量新增子件
batchComponentDataSave () {
this.$confirm("是否确认添加该"+ this.choosePartList.length +"条子件记录?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let tempData = {
site: this.modalData.site,
buNo: this.modalData.buNo,
partNo: this.modalData.partNo,
engChgLevel: this.modalData.engChgLevel,
bomType: this.modalData.bomType,
alternativeNo: this.detailData.alternativeNo,
consumptionItem: 'Consumed',
qtyPerAssembly: 0,
componentScrap: 0,
shrinkageFactor: this.batchComponentPartData.shrinkageFactor,
lineItemNo: '',
operationId: '',
operationNo: '',
issueToLoc: '',
issueToLocName: '',
noteText: '',
createBy: this.$store.state.user.name,
lineSequence: '',
issueType: 'Reserve And Backflush',
productFlag: 'component',
batchSaveList: this.choosePartList
}
batchSaveBomComponent(tempData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
this.batchComponentPartModelFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.batchComponentPartData = {
site: '',
buNo: '',
partNo: '',
partDesc: '',
shrinkageFactor: '',
page: 1,
limit: 10
}
})
})
},
// 新增替代方法
detailDataSave () {
if (this.saveDetailData.partNo === '' || this.saveDetailData.partNo == null) {
this.$message.warning('请先选择Bom物料!')
return
}
if (this.saveDetailData.engChgLevel === '' || this.saveDetailData.engChgLevel == null) {
this.$message.warning('请先填写Bom版本号!')
return
}
if (this.saveDetailData.bomType === '' || this.saveDetailData.bomType == null) {
this.$message.warning('请先选择制造类型!')
return
}
if (this.saveDetailData.alternativeNo === '' || this.saveDetailData.alternativeNo == null) {
this.$message.warning('请填写替代编码!')
return
}
if (this.saveDetailData.alternativeDescription === '' || this.saveDetailData.alternativeDescription == null) {
this.$message.warning('请填写替代名称!')
return
}
if (this.saveDetailData.status === '' || this.saveDetailData.status == null) {
this.$message.warning('请选择替代状态!')
return
}
if (this.saveDetailData.minLotQty === '' || this.saveDetailData.minLotQty == null) {
this.$message.warning('请填写最小订单数!')
return
}
this.saveDetailLoading = true
if (this.saveDetailData.flag === '1') {
bomDetailSave(this.saveDetailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows
this.detailData = this.saveDetailData
this.subDetailList = []
this.saveDetailModalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveDetailLoading = false
})
} else {
bomDetailUpdate(this.saveDetailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
this.saveDetailModalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveDetailLoading = false
})
}
},
// 批量修改工序模态框
batchUpdateOperationModal () {
if (this.checkedDetail.length === 0) {
this.$message.warning('请选择要编辑子物料!')
return
}
this.batchOperationData = {
operationId: '',
operationNo: '',
operationName: ''
}
this.batchOperationModelFlag = true
},
// 批量修改工序
batchOperationEdit () {
let tempData = {
informationList: this.checkedDetail,
operationId: this.batchOperationData.operationId,
updateBy: this.$store.state.user.name,
}
batchOperationEdit(tempData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows.subDetailList
this.batchOperationModelFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 获取基础数据列表S
getBaseList (val, type) {
this.tagNo = val
this.$nextTick(() => {
let strVal = ''
let conSql = ''
if (val === 215) {
strVal = this.componentData.issueToLoc
}
if (val === 510) {
conSql = " and site = '" + this.modalData.site + "'"
}
this.$refs.baseList.init(val, strVal, conSql)
})
},
// 列表方法的回调
getBaseData (val) {
if (this.tagNo === 215) {
this.componentData.issueToLoc = val.location_id
this.componentData.issueToLocName = val.location_name
}
if (this.tagNo === 510) {
this.modalData.processUnit = val.UMID
this.modalData.processUnitName = val.UMName
}
},
// 回车事件
focusNextInput (index, type) {
let aaa = ''
if (this.subDetailList.length - 1 === index) {
aaa = `${type}0`
} else {
aaa = `${type}${index + 1}`
}
this.$nextTick(() => {
this.$refs[aaa].focus()
})
},
}
}
</script>
<style lang="scss" scoped>
/deep/ .detail-tab .el-tabs__content {
height: 165px;
padding: 15px 0px 0px 0px;
}
/deep/ .sub_detail-tab .el-tabs__content {
height: 280px;
padding: 0px;
}
</style>