<template>
|
<div style="height: 100%">
|
<div class="page-header">
|
<div class="header-left">
|
<a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
|
<h2 v-if="editable">编辑-车间订单</h2>
|
<h2 v-if="!editable">查看-车间订单</h2>
|
</div>
|
<div class="btn-group header-right" v-if="editable">
|
<el-button :disabled="isSubmit" v-thinclick="`dataFormSubmit`"
|
>保存</el-button
|
>
|
</div>
|
</div>
|
<div class="page-main">
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="100px"
|
class="l-mes"
|
:disabled="!editable"
|
>
|
<div class="productorder-basic">
|
<el-row :gutter="10">
|
<el-col :span="6">
|
<el-form-item label="制造订单号" prop="moNo">
|
<el-input v-model="dataForm.moNo" disabled></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="车间订单类型" prop="workshopTypeCode">
|
<el-select
|
v-model="dataForm.workshopTypeCode"
|
placeholder=""
|
style="width:100%"
|
@change="workshopTypeCodeChange"
|
>
|
<el-option
|
v-for="(item, index) in bomTypeDbOptions"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="车间" prop="workShop">
|
<el-select
|
v-model="dataForm.workShop"
|
placeholder=""
|
style="width:100%"
|
>
|
<el-option
|
v-for="item in workShopOptions"
|
:key="item.id"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="零件" prop="partId">
|
<el-input v-model="partStr" placeholder="" readonly>
|
<el-button
|
v-if="!this.dataForm.id"
|
slot="append"
|
icon="el-icon-search"
|
@click="openRoutingDialog()"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="3">
|
<el-form-item label="需求数量" prop="qtyRequired">
|
<el-input
|
v-model="dataForm.qtyRequired"
|
placeholder=""
|
@change="checkNumber()"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="3">
|
<el-form-item label="完成数量" prop="qtyFinished">
|
<el-input-number
|
v-model="dataForm.qtyFinished"
|
placeholder=""
|
:controls="false"
|
></el-input-number>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="需求日期" prop="requiredDate">
|
<el-date-picker
|
v-model="dataForm.requiredDate"
|
style="width: 100%"
|
type="datetime"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
@change="checkDate()"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="备注" prop="remark">
|
<el-input v-model="dataForm.remark" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="制造属性" prop="manufactureAttr">
|
<el-select
|
v-model="dataForm.manufactureAttr"
|
placeholder=""
|
style="width:100%"
|
:disabled="dataForm.id ? true : false"
|
>
|
<el-option
|
v-for="item in manufactureAttrs"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :span="6">
|
<el-form-item label="外护颜色" prop="outerColor">
|
<el-input
|
readonly
|
v-model="dataForm.outerColor"
|
placeholder=""
|
></el-input>
|
</el-form-item>
|
</el-col>
|
|
<el-col :span="6">
|
<el-form-item label="绝缘颜色" prop="insulationColor">
|
<el-input
|
v-model="dataForm.insulationColor"
|
placeholder=""
|
></el-input>
|
</el-form-item>
|
</el-col> -->
|
</el-row>
|
<!-- <el-row :gutter="10">
|
<el-col :span="8">
|
<el-col
|
:span="8"
|
v-if="permissions.plan_manufacturingorder_bom_sure"
|
>
|
<el-form-item label="BOM确认">
|
<el-switch v-model="dataForm.bomConfirmStatus"> </el-switch>
|
</el-form-item>
|
</el-col>
|
<el-col
|
:span="8"
|
v-if="permissions.plan_manufacturingorder_process_sure"
|
>
|
<el-form-item label="工艺确认">
|
<el-switch v-model="dataForm.processConfirmStatus">
|
</el-switch>
|
</el-form-item>
|
</el-col>
|
<el-col
|
:span="8"
|
v-if="permissions.plan_manufacturingorder_test_sure"
|
>
|
<el-form-item label="检测标准确认">
|
<el-switch v-model="dataForm.standardConfirmStatus">
|
</el-switch>
|
</el-form-item>
|
</el-col>
|
</el-col>
|
<el-col :span="4">
|
<el-form-item
|
label="IFS车间订单接收时报告工序"
|
prop="isReportOperation"
|
label-width="200px"
|
>
|
<el-switch v-model="dataForm.isReportOperation" disabled>
|
</el-switch>
|
</el-form-item>
|
</el-col>
|
<el-col :span="2">
|
<el-form-item label="BOM确认">
|
<el-switch >
|
</el-switch>
|
</el-form-item>
|
</el-col>
|
<el-col :span="2">
|
<el-form-item label="工艺确认">
|
<el-switch >
|
</el-switch>
|
</el-form-item>
|
</el-col>
|
<el-col :span="3">
|
<el-form-item label="检测标准确认">
|
<el-switch >
|
</el-switch>
|
</el-form-item>
|
</el-col>
|
</el-row> -->
|
</div>
|
<div class="productorder-detail">
|
<el-card class="productorder-list">
|
<el-tabs type="card" ref="tabs">
|
<el-tab-pane label="工艺路线" id="ta0" key="ta0" name="ta0">
|
<!-- 之后把工艺界面嵌入进来 -->
|
<el-row>
|
<el-col :span="8">
|
<el-row>
|
<el-col :span="16">
|
<el-form-item label="工艺路线号">
|
<el-select
|
@change="routingSelectChanged"
|
v-model="dataForm.technologyRoutingId"
|
placeholder=""
|
:disabled="dataForm.mpsId != null ? true : false"
|
style="width:100%"
|
>
|
<el-option
|
v-for="item in dataForm.routingList"
|
:key="item.id"
|
:label="
|
item.routingNo +
|
'-' +
|
item.bomTypeDb +
|
'-' +
|
item.alternativeNo +
|
'-' +
|
item.alternativeDesc
|
"
|
:value="item.id"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :span="8">
|
<el-form-item label-width="0px">
|
<el-checkbox v-model="currentRouting.master" disabled
|
>默认工艺路线
|
</el-checkbox>
|
</el-form-item>
|
</el-col> -->
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="工艺路线备注">
|
<el-input
|
v-model="currentRouting.description"
|
placeholder=""
|
disabled
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row>
|
<el-col :span="24" class="productorder-operates-col">
|
<el-card class="productorder-operates">
|
<el-table
|
ref="operationTable"
|
:data="operations"
|
style="width: 100%;"
|
height="593px"
|
highlight-current-row
|
:default-sort="{ prop: 'operationOrder' }"
|
@row-click="operationRowClick"
|
>
|
<el-table-column
|
prop="operationOrder"
|
label="序号"
|
></el-table-column>
|
<el-table-column
|
prop="operationNo"
|
header-align="center"
|
align="center"
|
label="工序号"
|
></el-table-column>
|
<el-table-column
|
prop="operationName"
|
header-align="center"
|
align="center"
|
label="工序描述"
|
></el-table-column>
|
|
<el-table-column
|
prop="partName"
|
header-align="center"
|
align="center"
|
label="零件"
|
></el-table-column>
|
|
<el-table-column
|
prop="remark"
|
header-align="center"
|
align="center"
|
label="操作"
|
>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="openOrderOperation(scope.row)"
|
>编辑
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</el-col>
|
</el-row>
|
</el-col>
|
<el-col :span="16">
|
<el-tabs type="card" ref="paramTabs">
|
<el-tab-pane
|
label="生产要求"
|
key="tb0"
|
id="tb0"
|
name="tb0"
|
>
|
<el-card class="productorder-params-template">
|
<div slot="header">
|
<span>参数集</span>
|
<div style="float: right;">
|
<el-button
|
style="padding: 3px 0;color:#909399"
|
type="text"
|
size="medium"
|
v-if="
|
editable &&
|
dataForm.id &&
|
moRoutingOperationId != null
|
"
|
@click="openCustomizeTempalteDialog"
|
>自定义
|
</el-button>
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="
|
editable &&
|
dataForm.id &&
|
moRoutingOperationId != null
|
"
|
@click="openTempalteDialog"
|
>添加
|
</el-button>
|
</div>
|
</div>
|
<el-table
|
ref="templateTable"
|
:data="operationTemplateList"
|
class="l-mes"
|
height="563"
|
highlight-current-row
|
@row-click="templateRowClick"
|
>
|
<el-table-column
|
label="名称"
|
prop="operationTemplateName"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
label="类型"
|
prop="operationTemplateType"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column label="操作" align="center">
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
v-if="
|
editable &&
|
dataForm.id &&
|
moRoutingOperationId != null
|
"
|
@click.stop="saveTemplateChange(scope.row)"
|
>备注
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
v-if="
|
editable &&
|
dataForm.id &&
|
moRoutingOperationId != null
|
"
|
@click.stop="
|
handleTemplateDelete(
|
scope.row,
|
scope.$index
|
)
|
"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
<el-card class="productorder-template-param">
|
<div slot="header">
|
<span>参数</span>
|
<div style="float: right;">
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="editable && routingTemplateId != null"
|
@click="saveAllParamChange"
|
>保存
|
</el-button>
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="editable && routingTemplateId != null"
|
@click="openTempalteParamDialog"
|
>添加
|
</el-button>
|
</div>
|
</div>
|
<el-table
|
:data="templateParamList"
|
class="l-mes"
|
height="600"
|
>
|
<el-table-column
|
label="参数项"
|
prop="parameterItem"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span
|
>{{ scope.row.parameterItem }}({{
|
scope.row.unit
|
}})</span
|
>
|
</template>
|
</el-table-column>
|
<!-- <el-table-column
|
label="参数类型"
|
prop="type"
|
align="center"
|
:formatter="getParam"
|
>
|
</el-table-column> -->
|
<el-table-column
|
label="值"
|
prop="paramValue"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.paramValue"
|
placeholder="值"
|
:disabled="!editable"
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center">
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
v-if="editable && routingTemplateId != null"
|
@click.stop="
|
handleParamDelete(scope.row, scope.$index)
|
"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</el-tab-pane>
|
<el-tab-pane
|
label="检测标准"
|
key="tb1"
|
id="tb1"
|
name="tb1"
|
>
|
<testStandardTable
|
ref="moTestStandardTable"
|
:editable="editable"
|
:dataFormId="Number(dataForm.id)"
|
:moRoutingOperationId="Number(moRoutingOperationId)"
|
@refreshTestStandardInfo="refreshTestStandardInfo"
|
></testStandardTable>
|
</el-tab-pane>
|
<el-tab-pane
|
label="抽检规则"
|
key="tb2"
|
id="tb2"
|
name="tb2"
|
>
|
<div>
|
<div style="padding: 0px 20px;">
|
<el-button
|
type="primary"
|
@click="openAddSpotCheckRuleDialog"
|
>新增</el-button
|
>
|
</div>
|
<div>
|
<el-table
|
:data="spotCheckRuleList"
|
style="width: 100%"
|
>
|
<el-table-column
|
prop="ruleNo"
|
label="规则编号"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="ruleName"
|
label="规则名称"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="samplingOperationName"
|
label="抽检工序"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="retrospectOperationName"
|
label="追溯工序"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="applyType"
|
label="检测类型"
|
align="center"
|
:formatter="applyTypeFormatter"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="measurement"
|
label="抽检比例"
|
align="center"
|
:formatter="measurementFormatter"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="samplingPosition"
|
label="抽检位置"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
width="100"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="small"
|
@click="openEditSpotCheckRule(scope.row)"
|
>编辑</el-button
|
>
|
<el-button
|
type="text"
|
size="small"
|
@click="delSpotCheckRule(scope.row)"
|
>删除</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
</el-col>
|
</el-row>
|
</el-tab-pane>
|
|
<el-tab-pane label="产品结构" id="ta1" key="ta1" name="ta1">
|
<el-row>
|
<el-col :span="11">
|
<el-form-item label="完整BOM">
|
<el-select
|
@change="bomSelectChanged"
|
disabled
|
v-model="dataForm.bomId"
|
placeholder=""
|
style="width:100%;"
|
>
|
<el-option
|
v-for="item in dataForm.bomList"
|
:key="item.id"
|
:label="
|
item.number +
|
'-' +
|
item.bomTypeDb +
|
'-' +
|
item.version +
|
'-' +
|
item.alternativeNo +
|
'-' +
|
item.alternativeDesc
|
"
|
:value="item.id"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :offset="11" :span="2" style="text-align: center">
|
<el-button
|
type="text"
|
size="small"
|
icon="el-icon-circle-plus-outline"
|
style="color:#f56c6c;"
|
:disabled="!dataForm.id"
|
@click="addStruct()"
|
>添加元素
|
</el-button>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-table
|
default-expand-all
|
:data="components"
|
@selection-change="structSelectionChange"
|
row-key="id"
|
border
|
:tree-props="{
|
children: 'children'
|
}"
|
style="width: 100%"
|
height="400px"
|
:default-sort="{ prop: 'index' }"
|
>
|
<el-table-column type="selection" width="40" fixed="left" />
|
<el-table-column
|
type="index"
|
width="50"
|
header-align="center"
|
align="center"
|
label="序号"
|
/>
|
<el-table-column
|
type=""
|
prop="partNo"
|
width="200"
|
header-align="center"
|
align="center"
|
label="零件号"
|
/>
|
<el-table-column
|
prop="partName"
|
width=""
|
header-align="center"
|
align="left"
|
label="零件"
|
/>
|
<el-table-column
|
prop="operationName"
|
width=""
|
header-align="center"
|
align="center"
|
label="消耗工序"
|
/>
|
<el-table-column
|
prop="qpa"
|
width="150"
|
header-align="center"
|
align="center"
|
label="单位产出所需数量"
|
/>
|
<el-table-column
|
prop="total"
|
width="150"
|
header-align="center"
|
align="center"
|
label="需求总量"
|
>
|
<template slot-scope="scope">
|
{{ mul(scope.row.qpa, dataForm.qtyRequired) }}
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
prop="unit"
|
width="150"
|
header-align="center"
|
align="center"
|
label="单位"
|
/>
|
|
<el-table-column
|
prop="discNum"
|
width="150"
|
header-align="center"
|
align="center"
|
label="盘数(盘)"
|
/>
|
|
<!-- <el-table-column
|
prop="version"
|
width="150"
|
header-align="center"
|
align="center"
|
label="版本号"
|
/>
|
|
<el-table-column
|
prop="sheathColor"
|
width="150"
|
header-align="center"
|
align="center"
|
label="护套颜色"
|
/> -->
|
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="操作"
|
fixed="right"
|
width="130"
|
>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="small"
|
icon="el-icon-edit"
|
:disabled="!dataForm.id"
|
@click="addOrUpdateHandle(scope.row, scope.$index)"
|
>修改
|
</el-button>
|
<el-button
|
type="text"
|
size="small"
|
icon="el-icon-delete"
|
:disabled="!dataForm.id"
|
@click="deleteRow(scope.$index, scope.row.id)"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-row>
|
<el-row>
|
<el-col :span="24"
|
><div style="margin-top:5px;">
|
<span style="font-size:12px;">外协发料表</span>
|
</div>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-table
|
class="outsourcing-issue-table"
|
:data="dataForm.manufacturingOrderMatIssueList"
|
style="width: 100%;"
|
height="220px"
|
border
|
>
|
<el-table-column
|
type="index"
|
width="50"
|
label="序号"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partNo"
|
label="零件号"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partName"
|
label="零件描述"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="lotBatchNo"
|
label="批次号"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="unit"
|
label="单位"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="warehouse"
|
label="仓库"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="locationNo"
|
label="库位号"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="wdrNo"
|
label="WDR"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="qtyIssue"
|
label="已下发的数量"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="createUser"
|
label="创建人"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="createTime"
|
label="创建时间"
|
align="center"
|
>
|
</el-table-column>
|
</el-table>
|
</el-col>
|
</el-row>
|
</el-tab-pane>
|
<el-tab-pane label="客户订单" id="ta3" key="ta3" name="ta3">
|
<CustomerOrder :orderId="Number(dataForm.id)" />
|
</el-tab-pane>
|
</el-tabs>
|
</el-card>
|
</div>
|
</el-form>
|
</div>
|
<!-- 结构组件弹窗, 新增 / 修改 此处禁止修改零件-->
|
<component-form
|
@modifyComp="doModifyComp"
|
v-if="addOrUpdateVisible"
|
:partIsDisabled="true"
|
ref="addOrUpdate"
|
></component-form>
|
<routingDialog
|
:currshowlist.sync="showRouting"
|
:queryParam="{
|
bomTypeDb: this.dataForm.workshopTypeCode
|
}"
|
@listenToRoutingEvent="selectRouting"
|
/>
|
<customizeTemplateDialog
|
v-if="addCustomizeTemplateVisible"
|
ref="customizeTemplate"
|
@comfirmCustomizeTemplate="addCustomizeTemplate"
|
></customizeTemplateDialog>
|
<ParamTemplateDialog
|
:currshowlist.sync="showOperationTemplate"
|
@handleSelectionParamTemplateChange="selectOperationTemplate"
|
:paramTemplateObj="templateDefaultObj"
|
:paramTemplateSelArr="paramTemplateSelArr"
|
:paramTemplateSelCol="paramTemplateSelCol"
|
/>
|
<ParamDialog
|
:currshowlist.sync="showTemplateParam"
|
@handleSelectionChange="selectTemplateParam"
|
:paramSelArr="paramSelArr"
|
:paramSelCol="paramSelCol"
|
/>
|
<paramsRemarkDialog
|
v-if="addParamsRemarkVisible"
|
ref="paramsRemark"
|
@comfirmParamsRemark="addParamsRemark"
|
></paramsRemarkDialog>
|
<editOrderOperation
|
:currshowlist.sync="showOrderOperation"
|
:currOrderOperation="currOrderOperation"
|
></editOrderOperation>
|
<addStructForm
|
:currshowlist.sync="showStructForm"
|
:selectedStruct="selectedStruct"
|
:moId="moId"
|
@refreshBom="refreshBom"
|
></addStructForm>
|
<operationDialog
|
:currshowlist.sync="showOperation"
|
@listenToOperationEvent="addOperation"
|
/>
|
<insertOperationDialog
|
:currshowlist.sync="showInsertOperation"
|
@listenToOperationEvent="insertOperation"
|
/>
|
<spotCheckRule
|
:currshowlist.sync="spotCheckRuleShow"
|
:moId="Number(dataForm.id)"
|
:moRoutingOperationId="Number(moRoutingOperationId)"
|
:moRoutingOperationName="moRoutingOperationName"
|
@refreshSpotCheckRuleList="refreshSpotCheckRuleList"
|
/>
|
<spotCheckRuleEdit
|
:currshowlist.sync="editSpotCheckRuleShow"
|
:orderSamplingRuleId="currOrderSamplingRuleId"
|
@refreshSpotCheckRuleList="refreshSpotCheckRuleList"
|
/>
|
</div>
|
</template>
|
<style>
|
.productorder-basic {
|
background-color: #fff;
|
height: 150px;
|
padding: 10px 30px;
|
border: 1px solid #ddd;
|
box-sizing: border-box;
|
}
|
|
.productorder-detail {
|
width: 100%;
|
height: 800px;
|
padding-top: 10px;
|
box-sizing: border-box;
|
}
|
|
.productorder-detail .el-card__body {
|
padding: 0px 0px;
|
}
|
|
.productorder-list {
|
background-color: #fff;
|
width: 100%;
|
height: 100%;
|
border: 1px solid #ddd;
|
padding: 10px 20px;
|
}
|
|
.el-table__fixed {
|
height: 100% !important;
|
}
|
|
.el-table__fixed-right {
|
height: 100% !important;
|
}
|
|
.productorder-operates {
|
height: 605px;
|
border: 1px solid #ddd;
|
}
|
|
.productorder-params-template {
|
float: left;
|
background-color: #fff;
|
width: 40%;
|
height: 641px;
|
padding: 10px 0px;
|
margin-left: 10px;
|
border: 1px solid #ddd;
|
}
|
|
.productorder-template-param {
|
float: right;
|
background-color: #fff;
|
width: calc(60% - 20px);
|
height: 641px;
|
padding: 10px 0px;
|
border: 1px solid #ddd;
|
}
|
|
.productorder-template-param .el-input input {
|
text-align: center;
|
}
|
|
.productorder-operates-col {
|
margin-bottom: 0px;
|
}
|
</style>
|
|
<style scoped>
|
/deep/ .el-input-number.is-without-controls .el-input__inner {
|
text-align: start;
|
}
|
</style>
|
<script>
|
import {
|
getManufacturingOrder,
|
addManufacturingOrder,
|
putManufacturingOrder,
|
checkPart,
|
checkOutTechnologyRouting,
|
getRoutingTemplateForOrder,
|
deleteRoutingTemplateForOrder,
|
addRoutingTemplateForOrder,
|
getRoutingTemplateParamForOrder,
|
deleteRoutingTemplateParamForOrder,
|
putRoutingTemplateParamForOrder,
|
addRoutingTemplateParamLedForOrder,
|
updateMoBom,
|
delMoBom,
|
bomSelectChange
|
} from '@/api/plan/manufacturingorder'
|
import { qryMoSamplingRule, delMoSamplingRule } from '@/api/plan/mosamplingrule'
|
import {
|
getMoRoutingOption,
|
deleteMoRoutingOperation
|
} from '@/api/plan/morouting'
|
import { remote } from '@/api/admin/dict'
|
import { loadFactoryList } from '@/api/basic/factory'
|
import { getObj } from '@/api/technology/routing'
|
import { getObj as getBom } from '@/api/technology/completeproductstructure'
|
import ComponentForm from './structurecomponent-form'
|
import { validateSixDecimalNotNull } from '@/util/validate'
|
import { highPrecisionMul } from '@/util/highPrecision'
|
import routingDialog from './routing'
|
import customizeTemplateDialog from './customize-param-template'
|
import paramsRemarkDialog from './params-remark'
|
import ParamDialog from '@/views/common/param.vue'
|
import testStandardTable from './teststandardtable'
|
import CustomerOrder from './customerorder'
|
import editOrderOperation from './edit-order-operation'
|
import addStructForm from './add-struct-form'
|
import ParamTemplateDialog from '@/views/common/routingOperationTemplate.vue'
|
import { getObj as getSysParam } from '@/api/admin/sys-public-param'
|
import { sysParam } from '../../../config/sysParam' // 系统参数
|
import operationDialog from '@/views/common/operation.vue'
|
import insertOperationDialog from '@/views/common/operation.vue'
|
import spotCheckRule from './orderSpotCheckRule'
|
import spotCheckRuleEdit from './orderSpotCheckRuleEdit'
|
import { mapGetters } from 'vuex'
|
|
export default {
|
components: {
|
CustomerOrder,
|
ComponentForm,
|
routingDialog,
|
customizeTemplateDialog,
|
ParamTemplateDialog,
|
ParamDialog,
|
paramsRemarkDialog,
|
testStandardTable,
|
editOrderOperation,
|
addStructForm,
|
operationDialog,
|
insertOperationDialog,
|
spotCheckRule,
|
spotCheckRuleEdit
|
},
|
|
data() {
|
return {
|
typeOptions: [],
|
paramTemplateSelArr: [],
|
paramTemplateSelCol: 'operationTemplateNo',
|
templateDefaultObj: { dataType: '生产要求' },
|
paramSelArr: [],
|
paramSelCol: 'code',
|
numberState: false,
|
dateState: false,
|
queryParam: {},
|
showRouting: false,
|
addOrUpdateVisible: false,
|
showPart: false,
|
addCustomizeTemplateVisible: false,
|
addParamsRemarkVisible: false,
|
showOperationTemplate: false,
|
showTemplateParam: false,
|
routingOperationId: null,
|
moRoutingOperationId: null,
|
moRoutingOperationName: null,
|
routingTemplateId: null,
|
dataForm: {
|
id: 0,
|
factoryId: '',
|
workShop: '',
|
moNo: '',
|
partName: '',
|
partNo: '',
|
partId: '',
|
qtyRequired: '',
|
requiredDate: '',
|
remark: '',
|
state: null,
|
technologyRoutingId: null,
|
routingList: [],
|
outBatchList: [],
|
bomId: null,
|
bomRoot: null,
|
bomList: [],
|
outerColor: '',
|
insulationColor: '',
|
bomConfirmStatus: false,
|
processConfirmStatus: false,
|
standardConfirmStatus: false,
|
workshopTypeCode: 'M',
|
mpsId: null,
|
ifsManuorderApplyNo: null,
|
manufacturingOrderMatIssueList: [],
|
moRoutingOperationDTOList: [],
|
qtyApply: null,
|
startDate: null,
|
endDate: null,
|
manufactureAttr: 'N',
|
isReportOperation: false,
|
outPutBatchList: []
|
},
|
currentRow: [],
|
currentRouting: {}, // 当前选择的工艺
|
operations: [], // 当前选择工艺对应的工序
|
currentBom: {}, // 当前选择的产品结构
|
components: [], // 当前选择产品结构对应的结构组件
|
factoryOptions: [],
|
operationTemplateList: [], // 参数集
|
templateParamList: [], // 参数
|
dataRule: {
|
workshopTypeCode: [
|
{ required: true, message: '车间订单类型不能为空', trigger: 'blur' }
|
],
|
workShop: [
|
{ required: true, message: '车间不能为空', trigger: 'blur' }
|
],
|
partId: [{ required: true, message: '零件不能为空', trigger: 'blur' }],
|
qtyRequired: [
|
{ required: true, message: '需求数量不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalNotNull, trigger: 'blur' }
|
],
|
requiredDate: [
|
{ required: true, message: '需求日期不能为空', trigger: 'blur' }
|
]
|
},
|
isSubmit: false,
|
workShopOptions: [],
|
bomTypeDbOptions: [],
|
currOrderOperation: null,
|
showOrderOperation: false,
|
showStructForm: false,
|
structSelection: [],
|
selectedStruct: null,
|
moId: null,
|
manufactureAttrs: [],
|
showOperation: false,
|
insertRow: null,
|
showInsertOperation: false,
|
spotCheckRuleList: [],
|
spotCheckRuleShow: false,
|
editSpotCheckRuleShow: false,
|
currOrderSamplingRuleId: null,
|
reportTypeOptions: []
|
}
|
},
|
mounted() {
|
window.addEventListener(
|
'hashchange',
|
() => {
|
const currentPath = window.location.hash.slice(1)
|
if (this.$route.path !== currentPath) {
|
this.$router.push(currentPath)
|
}
|
},
|
false
|
)
|
},
|
created() {
|
this.dataForm.id = Number(this.$route.query.id)
|
if (this.$route.query.partId) {
|
this.dataForm.partId = Number(this.$route.query.partId)
|
}
|
if (this.$route.query.partName) {
|
this.dataForm.partName = String(this.$route.query.partName)
|
}
|
if (this.$route.query.partNo) {
|
this.dataForm.partNo = String(this.$route.query.partNo)
|
}
|
if (this.$route.query.mpsId) {
|
this.dataForm.mpsId = Number(this.$route.query.mpsId)
|
}
|
if (this.$route.query.qtyRequired) {
|
this.dataForm.qtyRequired = Number(this.$route.query.qtyRequired)
|
}
|
if (this.$route.query.requiredDate) {
|
this.dataForm.requiredDate = String(this.$route.query.requiredDate)
|
}
|
|
if (this.$route.query.outerColor) {
|
this.dataForm.outerColor = String(this.$route.query.outerColor)
|
}
|
|
if (this.$route.query.proposalNo) {
|
this.dataForm.ifsManuorderApplyNo = String(this.$route.query.proposalNo)
|
}
|
|
if (this.$route.query.soReqQty) {
|
this.dataForm.qtyApply = Number(this.$route.query.soReqQty)
|
}
|
|
if (this.$route.query.beginDate) {
|
this.dataForm.startDate = String(this.$route.query.beginDate)
|
}
|
|
if (this.$route.query.dueDate) {
|
this.dataForm.endDate = String(this.$route.query.dueDate)
|
}
|
|
this.initFactorySelect()
|
this.initReportTypeSelect()
|
this.getParamType()
|
this.getWorkShopOptions()
|
this.init()
|
// this.initTabs();
|
this.getBomTypeDbOptions()
|
this.getManufactureAttrs('manufacture_attr_type')
|
this.getSysParam(sysParam.IS_REPORT_OPERATION)
|
},
|
watch: {
|
'dataForm.partId'(newValue, oldValue) {
|
if (this.dataForm.id) {
|
if (oldValue !== '' && newValue !== oldValue && newValue) {
|
this.getFacturing(newValue)
|
}
|
} else {
|
if (newValue !== oldValue && newValue) {
|
this.getFacturing(newValue)
|
}
|
}
|
},
|
|
currentRouting(newValue, oldValue) {
|
if (newValue && newValue.id) {
|
if (this.dataForm.id != null && this.dataForm.id !== 0) {
|
// 校验工艺是否发生页面的选择修改
|
checkOutTechnologyRouting(
|
Object.assign({
|
technologyRoutingId: this.dataForm.technologyRoutingId,
|
id: this.dataForm.id
|
})
|
).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
if (data.data.status === '1') {
|
// 该工艺路线已绑定车间订单,查询车间订单下的工艺工序
|
getMoRoutingOption(this.dataForm.id).then((response) => {
|
if (response.data.code === 0) {
|
this.operations = response.data.data
|
} else {
|
this.operations = []
|
}
|
})
|
} else {
|
// 该工艺路线未绑定车间订单
|
// 查询工艺对应的工序
|
getObj(newValue.id).then((response) => {
|
if (response.data.code === 0) {
|
this.operations = response.data.data.operations
|
} else {
|
this.operations = []
|
}
|
})
|
}
|
}
|
})
|
}
|
|
// 清空当前工艺工序id、清空routingTemplateId、清空参数集operationTemplateList、清空参数templateParamList
|
this.routingOperationId = null
|
this.moRoutingOperationId = null
|
this.moRoutingOperationName = null
|
this.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
}
|
},
|
currentBom(newValue, oldValue) {
|
if (newValue && newValue.id) {
|
// 查询产品结构对应的组件
|
getBom(newValue.id).then((response) => {
|
this.components = [response.data.data.tree]
|
})
|
}
|
},
|
routingOperationId(newValue, oldValue) {
|
this.templateDefaultObj = Object.assign({
|
dataType: '生产要求',
|
routingOperationId: newValue
|
})
|
}
|
},
|
computed: {
|
...mapGetters(['permissions']),
|
partStr: function() {
|
return this.dataForm.partId
|
? this.dataForm.partName +
|
' ' +
|
(this.dataForm.partNo ? this.dataForm.partNo : '')
|
: ''
|
},
|
editable: function() {
|
if (!this.dataForm.id) {
|
return true
|
}
|
if (this.dataForm.id && this.dataForm.state === '01planned') {
|
return true
|
}
|
if (this.dataForm.id && this.dataForm.state === '02issued') {
|
return true
|
}
|
return false
|
}
|
},
|
methods: {
|
getSysParam(paramKey) {
|
getSysParam(paramKey).then((response) => {
|
var paramVal = response.data.data
|
if (response.data.code === 0) {
|
if (paramVal != null && paramVal === 'true') {
|
this.dataForm.isReportOperation = true
|
} else {
|
this.dataForm.isReportOperation = false
|
}
|
} else {
|
this.dataForm.isReportOperation = false
|
}
|
})
|
},
|
getManufactureAttrs(type) {
|
remote(type).then((response) => {
|
const code = response.data.code
|
if (code === 0) {
|
const _data = response.data.data
|
this.manufactureAttrs = _data
|
}
|
})
|
},
|
// 查询结构类型字典
|
getBomTypeDbOptions() {
|
remote('bom_type_db').then((response) => {
|
if (response.data.code === 0) {
|
this.bomTypeDbOptions = response.data.data
|
} else {
|
this.bomTypeDbOptions = []
|
}
|
})
|
},
|
doModifyComp(arg) {
|
const updateObj = {
|
partId: arg.partId,
|
partName: arg.partName,
|
partNo: arg.partNo,
|
qpa: arg.qpa,
|
id: this.currentRow.id,
|
operationId: arg.operationId,
|
operationName: arg.operationName,
|
operationNo: arg.operationNo
|
}
|
updateMoBom(updateObj).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
Object.assign(this.currentRow, arg)
|
this.$message.success('修改成功')
|
} else {
|
this.$message.error('修改失败')
|
}
|
})
|
},
|
init() {
|
this.$nextTick(() => {
|
this.clearData()
|
if (this.dataForm.id) {
|
this.getOrderInfo()
|
}
|
// else {
|
this.initTabs()
|
|
// }
|
})
|
},
|
// 查询当前车间订单信息
|
getOrderInfo() {
|
getManufacturingOrder(this.dataForm.id).then((response) => {
|
this.dataForm = response.data.data
|
// 把工艺挂上去
|
if (
|
this.dataForm.technologyRoutingId &&
|
this.dataForm.routingList &&
|
this.dataForm.routingList.length > 0
|
) {
|
const currentRouting = this.dataForm.routingList.find(
|
(item) => item.id === this.dataForm.technologyRoutingId
|
)
|
if (currentRouting) {
|
this.dataForm.technologyRoutingId = currentRouting.id
|
}
|
// 将工艺工序集合moRoutingOperationDTOList,挂上去operations
|
this.operations = this.dataForm.moRoutingOperationDTOList
|
}
|
// 把产品结构组件挂上去
|
if (this.dataForm.bomRoot) {
|
this.components = [this.dataForm.bomRoot]
|
}
|
})
|
},
|
initTabs() {
|
this.$refs.tabs.currentName = 'ta0'
|
this.$refs.paramTabs.currentName = 'tb0'
|
},
|
// 根据零件号去获取制造订单对应的数据
|
getFacturing(value) {
|
checkPart(value, this.dataForm.workshopTypeCode)
|
.then((response) => {
|
const manufacturingOrderDTO = response.data.data
|
/* this.dataForm.routingList = manufacturingOrderDTO.routingList.filter(
|
(e) => e.bomTypeDb === this.dataForm.workshopTypeCode
|
) */
|
this.dataForm.routingList = manufacturingOrderDTO.routingList
|
/* this.dataForm.bomList = manufacturingOrderDTO.bomList.filter(
|
(e) => e.bomTypeDb === this.dataForm.workshopTypeCode
|
) */
|
this.dataForm.bomList = manufacturingOrderDTO.bomList
|
this.dataForm.technologyRoutingId =
|
manufacturingOrderDTO.technologyRoutingId
|
if (manufacturingOrderDTO.technologyRoutingId) {
|
this.routingSelectChanged(manufacturingOrderDTO.technologyRoutingId)
|
} else {
|
this.operations = []
|
}
|
this.dataForm.bomId = manufacturingOrderDTO.bomId
|
if (manufacturingOrderDTO.bomId) {
|
this.bomSelectChanged(manufacturingOrderDTO.bomId)
|
} else {
|
this.components = []
|
}
|
})
|
.catch((e) => {
|
this.operations = []
|
this.components = []
|
this.dataForm.technologyRoutingId = null
|
this.dataForm.routingList = []
|
this.dataForm.bomList = []
|
this.dataForm.bomId = null
|
})
|
},
|
// 需求数量与订单需求数量的比较
|
checkNumber() {
|
if (this.dataForm.qtyRequired > this.dataForm.qtyProductionRequired) {
|
this.$message.error('需求数量大于订单需求数量')
|
this.numberState = true
|
} else {
|
this.numberState = false
|
}
|
},
|
checkDate() {
|
if (this.dataForm.requiredDate > this.dataForm.requiredProductionDate) {
|
this.$message.error('制造订单需求日期大于主生产计划需求日期')
|
this.dateState = true
|
} else {
|
this.dateState = false
|
}
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.numberState) {
|
this.isSubmit = false
|
this.$message.error('需求数量大于订单需求数量')
|
return
|
}
|
if (this.dateState) {
|
this.isSubmit = false
|
this.$message.error('制造订单需求日期大于主生产计划需求日期')
|
return
|
}
|
if (this.components && this.components.length > 0) {
|
this.dataForm.bomRoot = this.components[0]
|
} else {
|
this.dataForm.bomRoot = null
|
}
|
if (this.dataForm.id) {
|
putManufacturingOrder(this.dataForm)
|
.then((response) => {
|
this.isSubmit = false
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('修改成功')
|
// 再次查询车间订单信息
|
this.getOrderInfo()
|
this.$emit('refreshDataList')
|
} else {
|
this.$message.error('修改失败')
|
}
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
})
|
} else {
|
addManufacturingOrder(this.dataForm)
|
.then((response) => {
|
this.isSubmit = false
|
const data = response.data
|
if (data.code === 0) {
|
this.dataForm.id = data.data.id
|
this.dataForm.state = data.data.state
|
this.dataForm.moNo = data.data.moNo
|
this.dataForm.technologyRoutingId =
|
data.data.technologyRoutingId
|
this.dataForm.routingList = data.data.routingList
|
this.dataForm.bomRoot = data.data.bomRoot
|
this.dataForm.bomList = data.data.bomList
|
this.dataForm.bomId = data.data.bomId
|
this.dataForm.moRoutingOperationDTOList =
|
data.data.moRoutingOperationDTOList
|
// 产出批次
|
this.dataForm.outPutBatchList = data.data.outPutBatchList
|
|
// 将工艺工序集合moRoutingOperationDTOList,挂上去operations
|
this.operations = this.dataForm.moRoutingOperationDTOList
|
|
// 把产品结构组件挂上去
|
if (this.dataForm.bomRoot) {
|
this.components = [this.dataForm.bomRoot]
|
}
|
|
this.$message.success('添加成功')
|
this.$emit('refreshDataList')
|
// this.init()
|
} else {
|
this.$message.error('添加失败')
|
}
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
})
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
},
|
workshopTypeCodeChange() {
|
if (this.dataForm.partId != null && this.dataForm.partId != '') {
|
this.getFacturing(this.dataForm.partId)
|
}
|
},
|
// 1.tabs-主要
|
// 零件选择
|
openRoutingDialog() {
|
this.showRouting = true
|
},
|
selectRouting(param) {
|
if (param) {
|
this.dataForm.partNo = param.partNo
|
this.dataForm.partName = param.partName
|
this.dataForm.partId = param.partId
|
this.$refs.dataForm.validateField('partId', (valid) => {})
|
}
|
},
|
// 获取工厂的数据
|
initFactorySelect() {
|
loadFactoryList().then((res) => {
|
this.factoryOptions = res.data
|
|
// 新增 判断是否只有一个工厂 是的话 直接赋值
|
if (
|
!this.dataForm.id &&
|
this.factoryOptions &&
|
this.factoryOptions.length == 1
|
) {
|
this.dataForm.factoryId = this.factoryOptions[0].id
|
}
|
})
|
},
|
// 2.tabs-工艺路线
|
// 工艺路线选择
|
routingSelectChanged(routingId) {
|
this.currentRouting = this.dataForm.routingList.find(
|
(item) => item.id === routingId
|
)
|
},
|
// 产品结构选择
|
bomSelectChanged(bomId) {
|
// ********这边默认选择产品结构组件的表,而不是使用制造订单的备份组件表********
|
this.currentBom = this.dataForm.bomList.find((item) => item.id === bomId)
|
},
|
// 3.tabs-产品结构
|
// 新增 / 修改
|
addOrUpdateHandle(row, index) {
|
this.currentRow = row
|
this.addOrUpdateVisible = true
|
this.$nextTick(() => {
|
this.$refs.addOrUpdate.init(row, index, this.components)
|
})
|
},
|
// 删除
|
deleteRow(index, id) {
|
const root = this.components[0]
|
delMoBom(id).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
if (root.id === id) {
|
this.components = []
|
} else {
|
this.removeTreeNodeById(root, id)
|
}
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
})
|
},
|
|
removeTreeNodeById(node, id) {
|
if (node.children && node.children.length > 0) {
|
const count = node.children.filter((e) => e.id === id).length
|
// 已经找到
|
if (count > 0) {
|
node.children = node.children.filter((e) => e.id !== id)
|
} else {
|
node.children.forEach((n) => {
|
this.removeTreeNodeById(n, id)
|
})
|
}
|
}
|
},
|
|
// 精度计算需求总量
|
mul(a, b) {
|
if (!b) {
|
return
|
}
|
return highPrecisionMul(a, b)
|
},
|
// 清数据
|
clearData() {
|
this.$refs.dataForm.resetFields()
|
this.currentRouting = {}
|
this.currentBom = {}
|
this.operations = []
|
this.components = []
|
this.dataForm.routingList = []
|
this.dataForm.bomList = []
|
this.dataForm.technologyRoutingId = null
|
this.dataForm.bomId = null
|
},
|
// 点击工艺工序行触发校验工艺是否修改,若修改则不可操作,需先保存,若未修改,则可查询出对应的参数集
|
operationRowClick(row) {
|
if (this.dataForm.id != null && this.dataForm.id !== 0) {
|
this.routingOperationId = row.technologyRoutingOperationId
|
this.moRoutingOperationId = row.id
|
this.moRoutingOperationName = row.operationName
|
// 校验工艺是否发生页面的选择修改
|
checkOutTechnologyRouting(
|
Object.assign({
|
technologyRoutingId: this.dataForm.technologyRoutingId,
|
id: this.dataForm.id
|
})
|
).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
if (data.data.status === '1') {
|
// 请求获取工序参数集
|
getRoutingTemplateForOrder(
|
Object.assign({
|
id: this.dataForm.id,
|
moRoutingOperationId: row.id
|
})
|
).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.routingTemplateId = null
|
this.operationTemplateList = resData.data
|
// 设置首行高亮 并模拟点击首行
|
if (
|
this.operationTemplateList &&
|
this.operationTemplateList.length > 0
|
) {
|
this.$refs.templateTable.setCurrentRow(
|
this.operationTemplateList[0]
|
)
|
this.templateRowClick(this.operationTemplateList[0])
|
} else {
|
this.templateParamList = []
|
}
|
} else {
|
// 取消选中高亮
|
this.$refs.operationTable.setCurrentRow()
|
// 清空当前工艺工序id、清空routingTemplateId、清空参数集operationTemplateList、清空参数templateParamList
|
this.routingOperationId = null
|
this.moRoutingOperationId = null
|
this.moRoutingOperationName = null
|
this.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
this.$message.error('参数集请求异常')
|
}
|
})
|
// 请求获取检测标准
|
this.$refs.moTestStandardTable.getRoutingTestStandard(
|
Object.assign({
|
id: this.dataForm.id,
|
moRoutingOperationId: row.id
|
})
|
)
|
} else {
|
// 取消选中高亮
|
this.$refs.operationTable.setCurrentRow()
|
// 清空当前工艺工序id、清空routingTemplateId、清空参数集operationTemplateList、清空参数templateParamList
|
this.routingOperationId = null
|
this.moRoutingOperationId = null
|
this.moRoutingOperationName = null
|
this.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
this.$message.error('您已修改了工艺路线,请先保存,再进行操作')
|
}
|
} else {
|
// 取消选中高亮
|
this.$refs.operationTable.setCurrentRow()
|
// 清空当前工艺工序id、清空routingTemplateId、清空参数集operationTemplateList、清空参数templateParamList
|
this.routingOperationId = null
|
this.moRoutingOperationId = null
|
this.moRoutingOperationName = null
|
this.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
this.$message.error('请求异常')
|
}
|
})
|
// 刷新抽检规则
|
if (this.moRoutingOperationId != null) {
|
this.refreshSpotCheckRuleList()
|
}
|
} else {
|
this.$message.error('请先保存制造订单')
|
}
|
},
|
// 参数集点击事件
|
templateRowClick(row) {
|
this.getRoutingTemplateParam(row.id)
|
},
|
// 根据工艺工序id、模板id去获取模板下的参数
|
getRoutingTemplateParam(tempId) {
|
this.routingTemplateId = tempId
|
getRoutingTemplateParamForOrder(
|
Object.assign({
|
operationTemplateId: tempId
|
})
|
).then((response) => {
|
if (response.data.data[0] != null) {
|
this.templateParamList = response.data.data
|
} else {
|
this.templateParamList = []
|
}
|
})
|
},
|
// 弹出自定义参数集对话框
|
openCustomizeTempalteDialog() {
|
this.addCustomizeTemplateVisible = true
|
this.$nextTick(() => {
|
this.$refs.customizeTemplate.init(null)
|
})
|
},
|
// 弹出基础参数集模板对话框
|
openTempalteDialog() {
|
// 筛选出当前页面已有的参数集模板
|
this.paramTemplateSelArr = []
|
/*
|
if(this.operationTemplateList.length>0){
|
this.operationTemplateList.forEach(ele => {
|
if(ele.operationTemplateNo !=null && ele.operationTemplateNo !=''){
|
this.paramTemplateSelArr.push(ele.operationTemplateNo);
|
}
|
})
|
} */
|
this.showOperationTemplate = true
|
},
|
// 工序参数集模板的选中结果返回
|
selectOperationTemplate(param) {
|
if (param.length > 0) {
|
const templates = {
|
id: this.dataForm.id,
|
moRoutingOperationId: this.moRoutingOperationId,
|
routingOperationTemplateList: param
|
}
|
addRoutingTemplateForOrder(templates).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
const newTempaltes = response.data.data
|
for (let i = 0; i < newTempaltes.length; i++) {
|
this.operationTemplateList.push(newTempaltes[i])
|
}
|
this.$message.success('添加成功')
|
// 选中最后一个模板
|
this.selectTempalteByIndex(this.operationTemplateList.length - 1)
|
} else {
|
this.$message.error('添加失败')
|
}
|
})
|
}
|
},
|
// 弹出基础工序参数对话框
|
openTempalteParamDialog() {
|
// 筛选出当前页面已有的参数
|
this.paramSelArr = []
|
if (this.templateParamList.length > 0) {
|
this.templateParamList.forEach((ele) => {
|
if (ele.code != null && ele.code !== '') {
|
this.paramSelArr.push(ele.code)
|
}
|
})
|
}
|
this.showTemplateParam = true
|
},
|
// 参数的选中结果返回
|
selectTemplateParam(param) {
|
if (param.length > 0) {
|
const paramrrs = {
|
moRoutingOperationId: this.moRoutingOperationId,
|
operationTemplateId: this.routingTemplateId,
|
routingOperationParam: param
|
}
|
addRoutingTemplateParamLedForOrder(paramrrs).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
const newParams = response.data.data
|
for (let i = 0; i < newParams.length; i++) {
|
this.templateParamList.push(newParams[i])
|
}
|
this.$message.success('添加成功')
|
} else {
|
this.$message.error('添加失败')
|
}
|
})
|
}
|
},
|
// 弹出参数集修改的对话框
|
saveTemplateChange(row) {
|
this.addParamsRemarkVisible = true
|
this.$nextTick(() => {
|
this.$refs.paramsRemark.init(row.id, row.remark)
|
})
|
},
|
// 参数集修改后的回调方法
|
addParamsRemark(resultData) {
|
// 关闭弹出框
|
// this.addParamsRemarkVisible = true
|
// 将实时对象数据更新至页面视图
|
if (resultData.code === 0) {
|
var currentOperationTemplate = this.operationTemplateList.find(
|
(item) => item.id === resultData.data.id
|
)
|
if (currentOperationTemplate !== undefined) {
|
currentOperationTemplate.remark = resultData.data.remark
|
}
|
}
|
},
|
// 删除参数集
|
handleTemplateDelete(row, index) {
|
deleteRoutingTemplateForOrder(row.id).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
// 清空参数、删除当前行、清空选中、清空当前的routingTemplateId
|
this.operationTemplateList.splice(index, 1)
|
this.templateParamList = []
|
this.routingTemplateId = null
|
this.$refs.templateTable.setCurrentRow()
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
})
|
},
|
// 删除参数
|
handleParamDelete(row, index) {
|
deleteRoutingTemplateParamForOrder(row.id).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
// 删除当前行
|
this.templateParamList.splice(index, 1)
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
})
|
},
|
// 保存单个参数的修改
|
saveParamChange(row) {
|
const paramJson = { routingOperationParam: [row] }
|
putRoutingTemplateParamForOrder(paramJson).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
this.$message.success('保存成功')
|
} else {
|
this.$message.error('保存失败')
|
}
|
})
|
},
|
// 保存所有参数的修改
|
saveAllParamChange() {
|
const paramJson = { routingOperationParam: this.templateParamList }
|
putRoutingTemplateParamForOrder(paramJson).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
this.$message.success('保存成功')
|
} else {
|
this.$message.error('保存失败')
|
}
|
})
|
},
|
// 根据传参,选中某个模板,从0开始
|
selectTempalteByIndex(index) {
|
if (this.operationTemplateList && this.operationTemplateList.length > 0) {
|
this.$refs.templateTable.setCurrentRow(
|
this.operationTemplateList[index]
|
)
|
this.getRoutingTemplateParam(this.operationTemplateList[index].id)
|
}
|
},
|
// 返回自定义填写的
|
addCustomizeTemplate(data) {
|
this.addCustomizeTemplateVisible = false
|
const param = {
|
dataType: data.dataType,
|
operationTemplateName: data.templateName,
|
operationTemplateNo: data.templateNo,
|
operationTemplateType: data.templateType,
|
remark: data.remark
|
}
|
const paramArr = []
|
paramArr.push(param)
|
const templates = {
|
id: this.dataForm.id,
|
moRoutingOperationId: this.moRoutingOperationId,
|
routingOperationTemplateList: paramArr
|
}
|
addRoutingTemplateForOrder(templates).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
const newTempaltes = response.data.data
|
for (let i = 0; i < newTempaltes.length; i++) {
|
this.operationTemplateList.push(newTempaltes[i])
|
}
|
this.$message.success('添加成功')
|
// 选中最后一个模板
|
this.selectTempalteByIndex(this.operationTemplateList.length - 1)
|
} else {
|
this.$message.error('添加失败')
|
}
|
})
|
},
|
// 获取工序参数类型
|
getParamType() {
|
remote('technology_param').then((response) => {
|
if (response.data.code === 0) {
|
this.typeOptions = response.data.data
|
} else {
|
this.typeOptions = []
|
}
|
})
|
},
|
// 表格字段格式化
|
getParam(row, column, cellValue) {
|
for (let i = 0, len = this.typeOptions.length; i < len; i++) {
|
if (cellValue == this.typeOptions[i].value) {
|
return this.typeOptions[i].label
|
}
|
}
|
},
|
getWorkShopOptions() {
|
remote('work_shop').then((response) => {
|
if (response.data.code === 0) {
|
this.workShopOptions = response.data.data
|
} else {
|
this.workShopOptions = []
|
}
|
})
|
},
|
// 打开订单工艺工序编辑弹窗
|
openOrderOperation(row) {
|
if (row != null) {
|
if (this.dataForm.id != null && this.dataForm.id !== 0) {
|
// 校验工艺是否发生页面的选择修改
|
checkOutTechnologyRouting(
|
Object.assign({
|
technologyRoutingId: this.dataForm.technologyRoutingId,
|
id: this.dataForm.id
|
})
|
).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
if (data.data.status === '1') {
|
this.currOrderOperation = row
|
this.showOrderOperation = true
|
} else {
|
this.$message.error('您已修改了工艺路线,请先保存,再进行操作')
|
}
|
} else {
|
this.$message.error('请求异常')
|
}
|
})
|
} else {
|
this.$message.error('请先保存制造订单')
|
}
|
}
|
},
|
// 删除当前工序
|
deleteOrderOperation(row) {
|
deleteMoRoutingOperation(row.id).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
const delOperation = this.operations.find((item) => {
|
return item.id === row.id
|
})
|
const delIndex = this.operations.indexOf(delOperation)
|
this.operations.splice(delIndex, 1)
|
|
// 查找当前的选中的工序id
|
const selectedOperation = this.operations.find((item) => {
|
return item.id === this.moRoutingOperationId
|
})
|
// 存在选中的工序
|
if (selectedOperation) {
|
this.operationRowClick(selectedOperation)
|
} else {
|
// 不存在选中的工序,若this.operations不为空,则取第一条工序,若为空,则清空相关工序
|
if (this.operations.length > 0) {
|
this.operationRowClick(this.operations[0])
|
} else {
|
// 取消选中高亮
|
this.$refs.operationTable.setCurrentRow()
|
// 清空当前工艺工序id、清空routingTemplateId、清空参数集operationTemplateList、清空参数templateParamList
|
this.routingOperationId = null
|
this.moRoutingOperationId = null
|
this.moRoutingOperationName = null
|
this.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
}
|
}
|
this.$message.success('订单工序删除成功')
|
} else {
|
this.$message.error('订单工序删除失败')
|
}
|
})
|
},
|
// 弹出基础工序列表
|
addOrderOperation() {
|
if (this.dataForm.id != null && this.dataForm.id !== 0) {
|
// 校验工艺是否发生页面的选择修改
|
checkOutTechnologyRouting(
|
Object.assign({
|
technologyRoutingId: this.dataForm.technologyRoutingId,
|
id: this.dataForm.id
|
})
|
).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
if (data.data.status === '1') {
|
this.showOperation = true
|
} else {
|
this.$message.error('您已修改了工艺路线,请先保存,再进行操作')
|
}
|
} else {
|
this.$message.error('请求异常')
|
}
|
})
|
} else {
|
this.$message.error('请先保存制造订单')
|
}
|
},
|
breakInOrderOperation(row) {
|
this.showInsertOperation = true
|
this.insertRow = row
|
},
|
// 新增工序
|
addOperation(operation) {
|
console.log('operation', operation)
|
},
|
insertOperation(operation) {},
|
structSelectionChange(val) {
|
this.structSelection = val
|
},
|
// 打开bom节点
|
addStruct() {
|
if (this.structSelection.length <= 0) {
|
this.$message.error('请选择需要添加元素的节点')
|
} else {
|
if (this.structSelection.length === 1) {
|
this.selectedStruct = this.structSelection[0]
|
this.moId = Number(this.dataForm.id)
|
this.showStructForm = true
|
} else {
|
this.$message.error('只能为单个节点添加元素')
|
}
|
}
|
},
|
refreshBom(node) {
|
if (this.selectedStruct.children != null) {
|
this.selectedStruct.children.push(node)
|
} else {
|
this.selectedStruct.children = [node]
|
}
|
},
|
refreshSpotCheckRuleList() {
|
this.spotCheckRuleList = []
|
qryMoSamplingRule({
|
moId: Number(this.dataForm.id),
|
moRoutingOperationId: this.moRoutingOperationId
|
}).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.spotCheckRuleList = resData.data
|
}
|
})
|
},
|
openEditSpotCheckRule(row) {
|
this.currOrderSamplingRuleId = row.id
|
this.editSpotCheckRuleShow = true
|
},
|
delSpotCheckRule(row) {
|
delMoSamplingRule(row.id).then((response) => {
|
this.$message.success('删除成功')
|
this.refreshSpotCheckRuleList()
|
})
|
},
|
measurementFormatter(row) {
|
return row.samplingNumerator + '/' + row.samplingDenominator
|
},
|
applyTypeFormatter(row) {
|
const applyType = row.applyType
|
let applyTypeDesc = ''
|
if (applyType != null) {
|
const reportTypeOption = this.reportTypeOptions.find((item) => {
|
return item.value == applyType
|
})
|
if (reportTypeOption) {
|
applyTypeDesc = reportTypeOption.label
|
}
|
}
|
return applyTypeDesc
|
},
|
openAddSpotCheckRuleDialog() {
|
this.spotCheckRuleShow = true
|
},
|
initReportTypeSelect() {
|
remote('apply_report_type').then((response) => {
|
const code = response.data.code
|
if (code === 0) {
|
const _data = response.data.data
|
this.reportTypeOptions = _data
|
}
|
})
|
},
|
refreshTestStandardInfo() {
|
this.refreshSpotCheckRuleList()
|
}
|
}
|
}
|
</script>
|