<template>
|
<el-dialog
|
width="85%"
|
title="创建订单"
|
top="2vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
@closed="closedAnimation"
|
>
|
<div style="text-align:right;margin-bottom:10px;">
|
<div>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>保存</el-button
|
>
|
</div>
|
</div>
|
<div>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="100px"
|
class="l-mes"
|
>
|
<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="" disabled> </el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="6">
|
<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="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="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="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
|
>
|
<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-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="6">
|
<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-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
|
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: 'index' }"
|
@row-click="operationRowClick"
|
>
|
<el-table-column
|
prop="index"
|
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"
|
disabled
|
@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="
|
dataForm.id && moRoutingOperationId != null
|
"
|
@click="openCustomizeTempalteDialog"
|
>自定义
|
</el-button>
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="
|
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="
|
dataForm.id && moRoutingOperationId != null
|
"
|
@click.stop="saveTemplateChange(scope.row)"
|
>备注
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
v-if="
|
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="routingTemplateId != null"
|
@click="saveAllParamChange"
|
>保存
|
</el-button>
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="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="paramValue"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.paramValue"
|
placeholder="值"
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center">
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
v-if="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"
|
:dataFormId="dataForm.id"
|
:moRoutingOperationId="moRoutingOperationId"
|
></testStandardTable>
|
</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"
|
v-model="dataForm.bomId"
|
placeholder=""
|
disabled
|
>
|
<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-form-item label-width="0px"> </el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-table
|
default-expand-all
|
:data="components"
|
row-key="id"
|
border
|
:tree-props="{
|
children: 'children'
|
}"
|
style="width: 100%"
|
height="540px"
|
: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="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
|
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
|
@click="addOrUpdateHandle(scope.row, scope.$index)"
|
>修改
|
</el-button>
|
<el-button
|
type="text"
|
size="small"
|
icon="el-icon-delete"
|
disabled
|
@click="deleteRow(scope.$index, scope.row.id)"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-row>
|
</el-tab-pane>
|
</el-tabs>
|
</el-card>
|
</div>
|
</el-form>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">关 闭</el-button>
|
</div>
|
<!-- 结构组件弹窗, 新增 / 修改 -->
|
<component-form
|
@modifyComp="doModifyComp"
|
v-if="addOrUpdateVisible"
|
ref="addOrUpdate"
|
></component-form>
|
<routingDialog
|
:currshowlist.sync="showRouting"
|
:queryParam="queryParam"
|
@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>
|
</el-dialog>
|
</template>
|
<style>
|
.productorder-basic {
|
background-color: #fff;
|
height: 150px;
|
padding: 10px 30px;
|
border: 1px solid #ddd;
|
}
|
|
.productorder-detail {
|
width: 100%;
|
height: 800px;
|
padding-top: 10px;
|
}
|
|
.productorder-detail .el-card__body {
|
padding: 0px 0px;
|
}
|
|
.productorder-list {
|
box-sizing: border-box;
|
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>
|
<script>
|
import {
|
getManufacturingOrder,
|
addManufacturingOrder,
|
putManufacturingOrder,
|
checkPart,
|
checkOutTechnologyRouting,
|
getRoutingTemplateForOrder,
|
deleteRoutingTemplateForOrder,
|
addRoutingTemplateForOrder,
|
getRoutingTemplateParamForOrder,
|
deleteRoutingTemplateParamForOrder,
|
putRoutingTemplateParamForOrder,
|
addRoutingTemplateParamLedForOrder,
|
saveFromSchdule,
|
updateMoBom,
|
delMoBom
|
} from '@/api/plan/manufacturingorder'
|
import { remote } from '@/api/admin/dict'
|
import { loadFactoryList } from '@/api/basic/factory'
|
import { getObj, fetchList as fetchRoutingList } from '@/api/technology/routing'
|
import {
|
getObj as getBom,
|
fetchList as fetchStructList
|
} from '@/api/technology/completeproductstructure'
|
import ComponentForm from '@/views/plan/manufacturingorder/structurecomponent-form'
|
import { validateSixDecimalNotNull } from '@/util/validate'
|
import { highPrecisionMul } from '@/util/highPrecision'
|
import routingDialog from '@/views/plan/manufacturingorder/routing'
|
import customizeTemplateDialog from '@/views/plan/manufacturingorder/customize-param-template'
|
import paramsRemarkDialog from '@/views/plan/manufacturingorder/params-remark'
|
import ParamDialog from '@/views/common/param.vue'
|
import testStandardTable from '@/views/plan/manufacturingorder/teststandardtable'
|
import editOrderOperation from '@/views/plan/manufacturingorder/edit-order-operation'
|
import ParamTemplateDialog from '@/views/common/routingOperationTemplate.vue'
|
import { dateFormat } from '@/util/date'
|
import { getObj as getSysParam } from '@/api/admin/sys-public-param'
|
import { sysParam } from '../../../config/sysParam' // 系统参数
|
import { mapGetters } from 'vuex'
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
masterProductionInfo: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
}
|
},
|
components: {
|
ComponentForm,
|
routingDialog,
|
customizeTemplateDialog,
|
ParamTemplateDialog,
|
ParamDialog,
|
paramsRemarkDialog,
|
testStandardTable,
|
editOrderOperation
|
},
|
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,
|
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,
|
moRoutingOperationDTOList: [],
|
scheduleTheoryQuantityId: null,
|
qtyApply: null,
|
startDate: null,
|
endDate: null,
|
manufactureAttr: null,
|
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: [],
|
innerVisible: false,
|
bomTypeDbOptions: [],
|
currOrderOperation: null,
|
showOrderOperation: false,
|
manufactureAttrs: []
|
}
|
},
|
created() {
|
// this.initFactorySelect()
|
// this.getParamType()
|
// this.init()
|
this.getManufactureAttrs('manufacture_attr_type')
|
this.getSysParam(sysParam.IS_REPORT_OPERATION)
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.$nextTick(() => {
|
this.clearData()
|
this.getWorkShopOptions()
|
this.getBomTypeDbOptions()
|
this.initTabs()
|
this.initParam()
|
fetchRoutingList(
|
Object.assign(
|
{
|
current: 1,
|
size: 10
|
},
|
{ id: this.masterProductionInfo.technologyRoutingId }
|
)
|
).then((response) => {
|
this.dataForm.routingList = response.data.data.records
|
})
|
fetchStructList(
|
Object.assign(
|
{
|
current: 1,
|
size: 10
|
},
|
{ id: this.masterProductionInfo.bomId }
|
)
|
).then((response) => {
|
this.dataForm.bomList = response.data.data.records
|
})
|
})
|
}
|
},
|
|
currentRouting(newValue, oldValue) {
|
if (newValue && newValue.id) {
|
// 查询工艺对应的工序
|
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.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 : '')
|
: ''
|
}
|
},
|
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
|
}
|
})
|
},
|
initParam() {
|
this.dataForm.partName = this.masterProductionInfo.partName
|
this.dataForm.partNo = this.masterProductionInfo.partNo
|
this.dataForm.partId = this.masterProductionInfo.partId
|
this.dataForm.mpsId = this.masterProductionInfo.mpsId
|
this.dataForm.technologyRoutingId = this.masterProductionInfo.technologyRoutingId
|
this.dataForm.bomId = this.masterProductionInfo.bomId
|
this.dataForm.ifsManuorderApplyNo = this.masterProductionInfo.ifsManuorderApplyNo
|
this.dataForm.qtyApply = this.masterProductionInfo.soReqQty
|
this.dataForm.startDate = this.masterProductionInfo.beginDate
|
this.dataForm.endDate = this.masterProductionInfo.dueDate
|
this.dataForm.qtyRequired =
|
this.masterProductionInfo.qtyPlaned == 0
|
? this.masterProductionInfo.orderQuantity
|
: this.masterProductionInfo.qtyPlaned
|
this.dataForm.requiredDate = dateFormat(new Date())
|
this.dataForm.scheduleTheoryQuantityId = this.masterProductionInfo.scheduleTheoryQuantityId
|
this.dataForm.manufactureAttr = this.masterProductionInfo.manufactureAttr
|
this.dataForm.outPutBatchList = this.masterProductionInfo.outPutBatchList
|
},
|
// 查询结构类型字典
|
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
|
}
|
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) {
|
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]
|
}
|
})
|
}
|
// else {
|
this.initTabs()
|
|
// }
|
})
|
},
|
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
|
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
|
}
|
// 校验工艺路线、bom是否为空
|
if (
|
this.dataForm.technologyRoutingId == null ||
|
this.dataForm.technologyRoutingId == '' ||
|
this.dataForm.bomId == null ||
|
this.dataForm.bomId == ''
|
) {
|
this.isSubmit = false
|
this.$message.error(
|
'请选择合理的车间订单类型,检查零件对应的工艺路线或BOM是否已绑定!'
|
)
|
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
|
this.$message.success('修改成功')
|
this.$emit('refreshManualOrder')
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
})
|
} else {
|
saveFromSchdule(this.dataForm)
|
.then((response) => {
|
this.isSubmit = false
|
const data = response.data
|
if (data.code === 0) {
|
this.dataForm.id = data.data.id
|
this.dataForm.mpsId = data.data.mpsId
|
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
|
// 将工艺工序集合moRoutingOperationDTOList,挂上去operations
|
this.operations = this.dataForm.moRoutingOperationDTOList
|
|
// 把产品结构组件挂上去
|
if (this.dataForm.bomRoot) {
|
this.components = [this.dataForm.bomRoot]
|
}
|
|
this.$message.success('添加成功')
|
this.$emit('refreshManualOrder')
|
// this.init()
|
} else {
|
this.$message.success('添加失败')
|
}
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
})
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
},
|
// 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
|
this.dataForm.id = 0
|
this.dataForm.moRoutingOperationDTOList = []
|
this.dataForm.ifsManuorderApplyNo = null
|
this.dataForm.qtyApply = null
|
this.dataForm.startDate = null
|
this.dataForm.endDate = null
|
this.dataForm.mpsId = null
|
this.dataForm.workshopTypeCode = 'M'
|
this.dataForm.scheduleTheoryQuantityId = null
|
this.dataForm.outPutBatchList = []
|
this.routingOperationId = null
|
this.moRoutingOperationId = null
|
this.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
},
|
// 点击工艺工序行触发校验工艺是否修改,若修改则不可操作,需先保存,若未修改,则可查询出对应的参数集
|
operationRowClick(row) {
|
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') {
|
// 请求获取工序参数集
|
getRoutingTemplateForOrder(
|
Object.assign({
|
id: this.dataForm.id,
|
moRoutingOperationId: row.id
|
})
|
).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.routingOperationId = row.routingOperationId
|
this.moRoutingOperationId = row.id
|
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.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.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.routingTemplateId = null
|
this.operationTemplateList = []
|
this.templateParamList = []
|
this.$message.error('请求异常')
|
}
|
})
|
} 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) {
|
this.currOrderOperation = row
|
this.showOrderOperation = true
|
}
|
},
|
// 修改车间订单类型
|
workshopTypeCodeChange() {
|
this.getFacturing(this.dataForm.partId)
|
},
|
// 关闭动画
|
closedAnimation() {
|
this.$emit('closedOrder')
|
}
|
}
|
}
|
</script>
|