<template>
|
<el-dialog
|
:title="!dataForm.id ? '新增' : '修改'"
|
:fullscreen="isFullScreen"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
>
|
<el-tabs type="border-card" ref="resource">
|
<el-tab-pane label="工单">
|
<el-row>
|
<el-col :span="12">
|
<div class="mod-config">
|
<basic-container>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="100px"
|
class="l-mes"
|
:disabled="!editable"
|
>
|
<el-row>
|
<el-row :gutter="10">
|
<el-col :span="8">
|
<el-form-item label="工单编号" prop="optaskNo">
|
<el-input
|
v-model="dataForm.optaskNo"
|
placeholder="工单编号"
|
disabled
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="工艺" prop="routingNo">
|
<el-input
|
v-model="dataForm.routingNo"
|
placeholder="工艺"
|
disabled
|
>
|
<el-button
|
disabled
|
slot="append"
|
icon="el-icon-search"
|
@click="openRoutingDialog()"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="类型" prop="operationTaskType">
|
<el-select
|
v-model="dataForm.operationTaskType"
|
placeholder="请选择类型"
|
style="width:100%"
|
>
|
<el-option
|
v-for="(item, index) in workshopTypeOptions"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="8">
|
<el-form-item label="库位" prop="locationId">
|
<el-select
|
v-model="dataForm.locationId"
|
filterable
|
placeholder="请选择库位"
|
style="width:100%"
|
clearable
|
>
|
<el-option
|
v-for="(item, index) in locationOptions"
|
:label="item.locName"
|
:value="item.id"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="完成数量" prop="completedQuantity">
|
<el-input
|
v-model="dataForm.completedQuantity"
|
placeholder="完成数量"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item
|
label="实际开始时间"
|
prop="actualStartDate"
|
>
|
<el-date-picker
|
v-model="dataForm.actualStartDate"
|
style="width: 100%; color: red"
|
type="datetime"
|
placeholder="实际开始时间"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="8">
|
<el-form-item
|
label="实际完成时间"
|
prop="actualFinishDate"
|
>
|
<el-date-picker
|
v-model="dataForm.actualFinishDate"
|
style="width: 100%"
|
type="datetime"
|
placeholder="实际完成时间"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="工单类型" prop="combineState">
|
<el-select
|
v-model="dataForm.combineState"
|
filterable
|
placeholder="请选择工单类型"
|
style="width:100%"
|
clearable
|
>
|
<el-option
|
v-for="(item, index) in combineStateOptions"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="优先级" prop="priority">
|
<el-input
|
v-model="dataForm.priority"
|
placeholder="优先级"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="8">
|
<el-form-item label="计划数量2" prop="splannedQuantity">
|
<el-input
|
v-model="dataForm.splannedQuantity"
|
placeholder="计划数量2"
|
style="width:calc(100% - 20px)"
|
></el-input>
|
<span>{{ dataForm.sunit }}</span>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="盘数" prop="discNum">
|
<el-input
|
v-model="dataForm.discNum"
|
placeholder="盘数"
|
disabled
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="生产工时定额" prop="hourQuota">
|
<el-input
|
v-model="dataForm.hourQuota"
|
placeholder="生产工时定额"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="8">
|
<el-form-item label="载具规格" prop="reelSpec">
|
<el-input
|
v-model="dataForm.reelSpec"
|
placeholder="载具规格"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="制造属性" prop="manufactureAttr">
|
<el-select
|
v-model="dataForm.manufactureAttr"
|
filterable
|
placeholder="请选择制造属性"
|
style="width:100%"
|
disabled
|
>
|
<el-option
|
v-for="(item, index) in manufactureAttrs"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="备注" prop="remark">
|
<el-input
|
type="textarea"
|
:rows="2"
|
autosize
|
v-model="dataForm.remark"
|
placeholder="备注"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-row>
|
</el-form>
|
</basic-container>
|
</div>
|
</el-col>
|
<el-col :span="12">
|
<div class="mod-config">
|
<basic-container>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="100px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-row :gutter="10">
|
<el-col :span="11">
|
<el-form-item label="工序" prop="moRoutingOperationId">
|
<el-select
|
v-model="dataForm.moRoutingOperationId"
|
:disabled="!editable"
|
filterable
|
placeholder="请选择工序"
|
style="width:100%"
|
@change="selectChangedRoutingOperation"
|
>
|
<el-option
|
v-for="(item, index) in routingOptions"
|
:label="
|
item.operationName +
|
(item.partName ? ' + ' + item.partName : '')
|
"
|
:value="item.id"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="7">
|
<el-form-item label="工作中心" prop="workCenter">
|
<el-select
|
v-model="dataForm.workCenter"
|
:disabled="!editable"
|
filterable
|
placeholder="请选择工作中心"
|
style="width:100%"
|
@change="changeWorkCenter"
|
>
|
<el-option
|
v-for="(item, index) in workCenterOptions"
|
: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="workstationId">
|
<el-select
|
v-model="dataForm.workstationId"
|
:disabled="!editable"
|
filterable
|
placeholder="请选择工作站"
|
style="width:100%"
|
clearable
|
@change="selectLocationByWorkstation"
|
>
|
<el-option
|
v-for="(item, index) in workstations"
|
:label="item.name"
|
:value="item.id"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<el-col :span="14">
|
<el-form-item label="计划时间" prop="localDateTimes">
|
<el-date-picker
|
:class="tattimest ? 'sed' : ''"
|
v-model="dataForm.localDateTimes"
|
readonly
|
type="datetimerange"
|
range-separator="至"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
@change="selectChangedplannedDate"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10">
|
<el-form-item label="计划数量" prop="plannedQuantity">
|
<el-input
|
v-model="dataForm.plannedQuantity"
|
:disabled="!editable"
|
placeholder="计划数量"
|
style="width:calc(100% - 30px)"
|
@change="automaticScheduling()"
|
></el-input>
|
<span>{{ dataForm.unit }}</span>
|
</el-form-item>
|
</el-col></el-row
|
>
|
<el-row :gutter="10">
|
<el-col :span="12">
|
<el-form-item label="零件" prop="partName">
|
<el-input
|
v-model="dataForm.partName"
|
placeholder="零件"
|
disabled
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="零件号" prop="partNo">
|
<el-input
|
v-model="dataForm.partNo"
|
placeholder="零件号"
|
disabled
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item
|
label="工单所需时间"
|
prop="taskTheoreticalTime"
|
>
|
<el-input
|
v-model="dataForm.taskTheoreticalTime"
|
placeholder="工单所需时间"
|
style="width:calc(100% - 30px)"
|
disabled
|
></el-input>
|
<span>min</span>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="10">
|
<span
|
style="float:right; margin-right:30px; margin-top: 55px"
|
>
|
<el-button
|
type="primary"
|
:disabled="!editable"
|
style="margin-left: 12px; margin-bottom:10px"
|
@click="automaticScheduling"
|
>自动排程</el-button
|
></span
|
>
|
</el-row>
|
</el-row>
|
</el-form>
|
</basic-container>
|
</div>
|
</el-col>
|
</el-row>
|
<div>
|
<basic-container>
|
<div style="float: right">
|
<div>
|
<div class="status">
|
<div class="itemClass">
|
<div class="circle scene"></div>
|
<label>草稿</label>
|
</div>
|
<div class="itemClass">
|
<div class="circle pending"></div>
|
<label>等待</label>
|
</div>
|
<div class="itemClass">
|
<div class="circle inProgress"></div>
|
<label>进行中</label>
|
</div>
|
<div class="itemClass">
|
<div class="circle interrupted"></div>
|
<label>已暂停</label>
|
</div>
|
<div class="itemClass">
|
<div class="circle completed"></div>
|
<label>已完成</label>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div style="margin-top:40px">
|
<gantt-index
|
v-if="isshow"
|
ref="ganttIndex"
|
:dataForm="dataForm"
|
></gantt-index>
|
</div>
|
</basic-container>
|
</div>
|
</el-tab-pane>
|
<!-- <el-tab-pane label="配盘单">-->
|
<!-- <el-card class="no-padding-top">-->
|
<!-- <el-table-->
|
<!-- ref="templateTable"-->
|
<!-- :data="dataForm.operationTemplateList"-->
|
<!-- class="l-mes"-->
|
<!-- height="150"-->
|
<!-- highlight-current-row-->
|
<!-- @row-click="templateRowClick"-->
|
<!-- >-->
|
<!-- <el-table-column-->
|
<!-- label="名称"-->
|
<!-- prop="operationTemplateName"-->
|
<!-- align="center"-->
|
<!-- min-width="90px"-->
|
<!-- >-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column-->
|
<!-- label="类型"-->
|
<!-- prop="operationTemplateType"-->
|
<!-- align="center"-->
|
<!-- min-width="90px"-->
|
<!-- >-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column-->
|
<!-- label="状态"-->
|
<!-- prop="approvalStatus"-->
|
<!-- align="center"-->
|
<!-- min-width="60px"-->
|
<!-- >-->
|
<!-- <template slot-scope="scope">-->
|
<!-- <el-tag size="mini" v-if="scope.row.approvalStatus === '01'"-->
|
<!-- >待审核</el-tag-->
|
<!-- >-->
|
<!-- <el-tag-->
|
<!-- type="warning"-->
|
<!-- size="mini"-->
|
<!-- v-if="scope.row.approvalStatus === '02'"-->
|
<!-- >审核中</el-tag-->
|
<!-- >-->
|
<!-- <el-tag-->
|
<!-- type="success"-->
|
<!-- size="mini"-->
|
<!-- v-if="scope.row.approvalStatus === '03'"-->
|
<!-- >通过</el-tag-->
|
<!-- >-->
|
<!-- <el-tag-->
|
<!-- type="danger"-->
|
<!-- size="mini"-->
|
<!-- v-if="scope.row.approvalStatus === '04'"-->
|
<!-- >退回</el-tag-->
|
<!-- >-->
|
<!-- </template>-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column-->
|
<!-- label="备注"-->
|
<!-- prop="remark"-->
|
<!-- align="center"-->
|
<!-- min-width="120px"-->
|
<!-- >-->
|
<!-- <template slot-scope="scope">-->
|
<!-- <el-input v-model="scope.row.remark"></el-input>-->
|
<!-- </template>-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column align="center" width="70px" fixed="right">-->
|
<!-- <template slot="header" slot-scope="scope">-->
|
<!-- <el-button-->
|
<!-- type="text"-->
|
<!-- size="mini"-->
|
<!-- @click.stop="openTempalteDialog()"-->
|
<!-- >添加</el-button-->
|
<!-- >-->
|
<!-- </template>-->
|
<!-- <template slot-scope="scope">-->
|
<!-- <el-button-->
|
<!-- type="text"-->
|
<!-- size="mini"-->
|
<!-- @click.stop="handleTemplateDelete(scope.row, scope.$index)"-->
|
<!-- >删除-->
|
<!-- </el-button>-->
|
<!-- </template>-->
|
<!-- </el-table-column>-->
|
<!-- </el-table>-->
|
<!-- </el-card>-->
|
<!-- <el-card class="no-padding-top">-->
|
<!-- <div slot="header">-->
|
<!-- <span>参数</span>-->
|
<!-- </div>-->
|
<!-- <el-table :data="templateParamList" class="l-mes" height="300">-->
|
<!-- <el-table-column-->
|
<!-- label="参数项"-->
|
<!-- prop="parameterItem"-->
|
<!-- align="center"-->
|
<!-- min-width="100px"-->
|
<!-- >-->
|
<!-- <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"-->
|
<!-- min-width="100px"-->
|
<!-- >-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column-->
|
<!-- label="值"-->
|
<!-- prop="paramValue"-->
|
<!-- align="center"-->
|
<!-- min-width="100px"-->
|
<!-- >-->
|
<!-- <template slot-scope="scope">-->
|
<!-- <el-input-->
|
<!-- v-model="scope.row.paramValue"-->
|
<!-- :disabled="!editable"-->
|
<!-- ></el-input>-->
|
<!-- </template>-->
|
<!-- </el-table-column>-->
|
<!-- <el-table-column align="center" width="70px" fixed="right">-->
|
<!-- <template slot="header" slot-scope="scope">-->
|
<!-- <el-button-->
|
<!-- type="text"-->
|
<!-- size="mini"-->
|
<!-- v-if="routingTemplate !== null && unapproved"-->
|
<!-- @click.stop="openTempalteParamDialog()"-->
|
<!-- >添加</el-button-->
|
<!-- >-->
|
<!-- </template>-->
|
<!-- <template slot-scope="scope">-->
|
<!-- <el-button-->
|
<!-- type="text"-->
|
<!-- size="mini"-->
|
<!-- v-if="routingTemplate !== null && unapproved"-->
|
<!-- @click.stop="handleParamDelete(scope.row, scope.$index)"-->
|
<!-- >删除-->
|
<!-- </el-button>-->
|
<!-- </template>-->
|
<!-- </el-table-column>-->
|
<!-- </el-table>-->
|
<!-- </el-card>-->
|
<!-- </el-tab-pane>-->
|
<el-tab-pane label="工单供应表" v-if="this.dataForm.id">
|
<manufacturing-order
|
:operationId="this.dataForm.id"
|
ref="manufacturing"
|
></manufacturing-order>
|
</el-tab-pane>
|
<el-tab-pane label="工单所需物料" v-if="this.dataForm.id">
|
<operation-supply
|
:operationId="this.dataForm.id"
|
:routingOperationId="this.dataForm.moRoutingOperationId"
|
ref="manufacturing"
|
></operation-supply>
|
</el-tab-pane>
|
</el-tabs>
|
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>确定</el-button
|
>
|
<!--<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmitReserved`"
|
v-if="editable"
|
>确定并物料预留</el-button
|
>-->
|
</span>
|
<routingDialog
|
:currshowlist.sync="showRouting"
|
:mutiSelect="false"
|
:queryParam="queryParam"
|
@listenToRoutingEvent="selectRouting"
|
/>
|
<workstationDialog
|
:currshowlist.sync="showWorkstation"
|
@listenToWorkStationEvent="selectWorkstation"
|
/>
|
<locationDialog
|
:currshowlist.sync="showLocation"
|
@listenToLocationEvent="selectLocation"
|
:queryParam="queryParamLocation"
|
/>
|
|
<ParamTemplateDialog
|
:currshowlist.sync="showOperationTemplate"
|
@handleSelectionParamTemplateChange="selectOperationTemplate"
|
:paramTemplateObj="templateDefaultObj"
|
/>
|
<ParamDialog
|
:currshowlist.sync="showTemplateParam"
|
@handleSelectionChange="selectTemplateParam"
|
:paramSelArr="paramSelArr"
|
:paramSelCol="paramSelCol"
|
/>
|
</el-dialog>
|
</template>
|
|
<style lang="scss" scoped>
|
.el-range-editor.el-input__inner {
|
border: none;
|
border-bottom: 1px solid gainsboro;
|
}
|
/deep/ .sed .el-range-input {
|
color: red !important;
|
}
|
.no-padding-top .el-card__body {
|
padding: 0px 0px 5px;
|
}
|
|
.status {
|
height: 100%;
|
padding: 0 20px;
|
display: flex;
|
flex-direction: row;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.status label {
|
font-size: 12px;
|
font-weight: 500;
|
padding-top: 4px;
|
color: #333;
|
}
|
|
.itemClass {
|
width: 45px;
|
display: inline-block;
|
flex-direction: column;
|
align-items: center;
|
}
|
|
.circle {
|
width: 16px;
|
height: 16px;
|
border-radius: 50%;
|
}
|
|
.scene {
|
background-color: #999d9c;
|
border-color: #999d9c;
|
}
|
</style>
|
<script>
|
import { fetchListExt } from '@/api/warehouse/location'
|
import { addObj, getObj, putObj } from '@/api/plan/operationtask'
|
import { getAllWorkstationList, loadWorkstation } from '@/api/basic/workstation'
|
import { getOperationParam } from '@/api/basic/template'
|
import { getQpaNumber } from '@/api/plan/manufacturingorder'
|
import ElRow from 'element-ui/packages/row/src/row'
|
import ElCol from 'element-ui/packages/col/src/col'
|
import routingDialog from '@/views/plan/manufacturingorder/routing.vue'
|
import workstationDialog from '@/views/common/workstation.vue'
|
import locationDialog from '@/views/common/location.vue'
|
|
import {
|
validateSixDecimalNotNull,
|
validateSixDecimal
|
} from '../../../util/validate'
|
import { getObj as getRout } from '@/api/technology/routing'
|
import ManufacturingOrder from './manufacturingorder'
|
import ganttIndex from './gantt-index'
|
import OperationSupply from './operationMaterial'
|
import ParamTemplateDialog from '@/views/common/operationParamTemplate.vue'
|
import { remote } from '@/api/admin/dict'
|
import ParamDialog from '@/views/common/param.vue'
|
import { highPrecisionMul } from '@/util/highPrecision'
|
import { getMoRouting } from '@/api/plan/morouting'
|
import { calOperationTaskTime, autoSetTime } from '@/api/plan/schedule'
|
|
export default {
|
components: {
|
ElCol,
|
ElRow,
|
routingDialog,
|
workstationDialog,
|
locationDialog,
|
ManufacturingOrder,
|
OperationSupply,
|
ParamTemplateDialog,
|
ParamDialog,
|
ganttIndex
|
},
|
data() {
|
return {
|
routingList: [],
|
routingOptions: [],
|
locationOptions: [],
|
workstationOption: [],
|
operationList: {},
|
operationTasks: {},
|
showWorkstation: false,
|
showLocation: false,
|
isFullScreen: true,
|
isshow: true,
|
queryParam: {},
|
queryParamLocation: {},
|
showRouting: false,
|
visible: false,
|
tattimest: false,
|
tableData: [],
|
dataForm: {
|
id: 0,
|
optaskNo: '',
|
routingId: '',
|
priority: '',
|
routingOperationId: null,
|
state: '',
|
plannedQuantity: '',
|
completedQuantity: '',
|
localDateTimes: [],
|
plannedStartDate: '',
|
plannedFinishDate: '',
|
actualStartDate: '',
|
actualFinishDate: '',
|
remark: '',
|
discNum: null,
|
routingNo: '',
|
workstationName: '',
|
moId: '',
|
workstationId: '',
|
operationTemplateList: [],
|
locationName: '',
|
locationId: null,
|
partName: '',
|
partNo: '',
|
partId: null,
|
unit: '',
|
operationName: '',
|
hourQuota: null,
|
combineState: '0',
|
operationTaskType: null,
|
workCenter: null,
|
moRoutingOperationId: null,
|
splannedQuantity: 0,
|
sunit: '',
|
manufactureAttr: 'N',
|
outPutBatchList: [],
|
reelSpec: null,
|
taskTheoreticalTime: null
|
},
|
dataRule: {
|
moRoutingOperationId: [
|
{ required: true, message: '工序不能为空', trigger: 'change' }
|
],
|
routingNo: [
|
{ required: true, message: '工艺不能为空', trigger: 'blur' }
|
],
|
operationTaskType: [
|
{ required: true, message: '类型不能为空', trigger: 'change' }
|
],
|
workCenter: [
|
{ required: true, message: '工作中心不能为空', trigger: 'change' }
|
],
|
plannedQuantity: [
|
{ required: true, message: '接收数量不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalNotNull, trigger: 'blur' }
|
],
|
hourQuota: [{ validator: validateSixDecimal, trigger: 'blur' }]
|
},
|
showOperationTemplate: false,
|
templateDefaultObj: { templateType: '配盘单' },
|
templateParamList: [],
|
typeOptions: [],
|
routingTemplate: null,
|
workCenter: null,
|
unapproved: true, // 当前选择参数集是否未审核
|
showTemplateParam: false,
|
paramSelArr: [],
|
paramSelCol: 'code',
|
qtyRequired: 0,
|
isSubmit: false,
|
combineStateOptions: [],
|
workshopTypeOptions: [],
|
workCenterOptions: [],
|
workstations: [],
|
manufactureAttrs: []
|
}
|
},
|
computed: {
|
editable: function() {
|
if (!this.dataForm.id) {
|
return true
|
}
|
if (this.dataForm.id && this.dataForm.state == '01pending') {
|
return true
|
}
|
return false
|
}
|
},
|
created() {
|
this.getParamType()
|
this.initDirTestType()
|
this.getWrkshopTypeOptions()
|
this.getWorkCenterOptions()
|
this.getManufactureAttrs('manufacture_attr_type')
|
},
|
mounted() {
|
window.addEventListener(
|
'popstate',
|
function(e) {
|
this.visible = false
|
}.bind(this),
|
false
|
)
|
},
|
watch: {
|
'dataForm.routingId': {
|
handler(newValue, oldValue) {
|
if (newValue) {
|
getMoRouting(this.dataForm.moId).then((response) => {
|
this.routingList = response.data.data
|
this.routingOptions = this.routingList.moRoutingOperationDTOList
|
})
|
}
|
}
|
}
|
},
|
methods: {
|
// // 全屏
|
// fullscreen() {
|
// this.isFullScreen = !this.isFullScreen
|
// },
|
getManufactureAttrs(type) {
|
remote(type).then((response) => {
|
const code = response.data.code
|
if (code === 0) {
|
const _data = response.data.data
|
this.manufactureAttrs = _data
|
}
|
})
|
},
|
changeWorkCenter() {
|
this.workstations = []
|
this.dataForm.workstationId = null
|
this.locationOptions = []
|
this.dataForm.locationId = null
|
this.workCenter = this.dataForm.workCenter
|
this.$nextTick(() => {
|
this.$refs.ganttIndex.init(this.workCenter)
|
})
|
|
this.changeWorkCenterAction()
|
},
|
changeWorkCenterAction() {
|
if (this.dataForm.workCenter) {
|
const queryParamStation = Object.assign({
|
workCenter: this.dataForm.workCenter
|
})
|
|
getAllWorkstationList(queryParamStation).then((response) => {
|
const resData = response.data.data
|
if (resData && resData.length > 0) {
|
this.workstations = resData
|
}
|
})
|
}
|
},
|
getWorkCenterOptions() {
|
remote('work_center_type').then((response) => {
|
if (response.data.code === 0) {
|
this.workCenterOptions = response.data.data
|
console.log(this.workCenterOptions)
|
this.workCenterOptions.forEach((item) => {
|
item.label = '(' + item.value + ') ' + item.label
|
})
|
}
|
})
|
},
|
getWrkshopTypeOptions() {
|
remote('workshop_type').then((response) => {
|
if (response.data.code === 0) {
|
this.workshopTypeOptions = response.data.data
|
} else {
|
this.workshopTypeOptions = []
|
}
|
})
|
},
|
// 数据字典传值
|
initDirTestType() {
|
remote('combineState_type').then((response) => {
|
if (response.data.code === 0) {
|
this.combineStateOptions = response.data.data
|
} else {
|
this.combineStateOptions = []
|
}
|
})
|
},
|
openRoutingDialog() {
|
this.showRouting = true
|
},
|
selectRouting(routing) {
|
this.dataForm.routingId = routing.id
|
this.dataForm.routingNo = routing.routingNo
|
this.dataForm.moRoutingOperationId = null
|
// this.dataForm.partName = routing.partName
|
// this.dataForm.partId = routing.partId
|
this.$refs.dataForm.validateField('routingNo', (valid) => {})
|
},
|
openWorkstationDialog() {
|
this.showWorkstation = true
|
},
|
// openLocationDialog() {
|
// debugger;
|
// if(!this.dataForm.workstationId){
|
// this.$message.error('请选择工作站后再选择库位!');
|
// return
|
// }
|
// this.queryParamLocation = Object.assign({
|
// workstationId: this.dataForm.workstationId ,
|
// locType: 4,
|
|
// });
|
// this.showLocation = true
|
// },
|
selectWorkstation(workstation) {
|
console.log(workstation)
|
if (workstation) {
|
this.dataForm.workstationId = workstation.id
|
this.dataForm.workstationName = workstation.name
|
this.selectLocationByWorkstation()
|
}
|
// this.queryParamLocation = {};
|
},
|
selectLocation(location) {
|
if (location) {
|
this.dataForm.locationId = location.id
|
this.dataForm.locationName = location.locName
|
}
|
},
|
|
init(id, param, outPutBatchList, qtyPlaned) {
|
if (param) {
|
console.log(param)
|
this.qtyRequired = param.qtyRequired
|
this.dataForm.moId = param.id
|
this.dataForm.moNo = param.moNo
|
this.dataForm.manufactureAttr = param.manufactureAttr
|
this.dataForm.operationTaskType = param.workshopTypeCode
|
if (param.technologyRoutingId) {
|
getMoRouting(this.dataForm.moId).then((response) => {
|
this.routingList = response.data.data
|
this.routingOptions = this.routingList.moRoutingOperationDTOList
|
this.dataForm.routingId = this.routingList.technologyRoutingId
|
this.dataForm.routingNo = this.routingList.routingNo
|
// this.dataForm.partName = this.routingList.partName
|
// this.dataForm.partId = this.routingList.partId
|
// 制造订单form创建的,自动带出工序
|
if (param.selectedRoutingOperationId && this.routingOptions) {
|
const option = this.routingOptions.find(
|
(e) => e.id === param.selectedRoutingOperationId
|
)
|
if (option && option.id) {
|
this.dataForm.moRoutingOperationId = option.id
|
this.selectChangedRoutingOperation(option.id)
|
}
|
}
|
})
|
}
|
}
|
this.dataForm.id = id || 0
|
this.visible = true
|
this.dataForm.state = '01pending'
|
this.dataForm.operationTemplateList = []
|
this.templateParamList = []
|
this.$nextTick(() => {
|
if (this.dataForm.id) {
|
this.$refs.dataForm.resetFields()
|
getObj(this.dataForm.id).then((response) => {
|
this.dataForm = response.data.data
|
// 获取对应配盘单
|
/* getOperationTemplateById(this.dataForm.id).then((response) => {
|
this.dataForm.operationTemplateList = response.data.data
|
}) */
|
this.changeWorkCenterAction()
|
this.selectLocationByWorkstationAction()
|
this.$nextTick(() => {
|
this.$refs.ganttIndex.init(this.dataForm.workCenter)
|
})
|
})
|
} else {
|
this.dataForm.plannedQuantity = qtyPlaned
|
this.dataForm.outPutBatchList = outPutBatchList
|
this.dataForm.moRoutingOperationId = null
|
this.dataForm.workCenter = null
|
this.dataForm.partName = null
|
this.dataForm.partNo = null
|
this.dataForm.partId = null
|
this.dataForm.workstationId = null
|
this.dataForm.localDateTimes = []
|
this.dataForm.plannedStartDate = null
|
this.dataForm.plannedFinishDate = null
|
this.$nextTick(() => {
|
this.$refs.ganttIndex.init(this.dataForm.workCenter, 1)
|
})
|
}
|
})
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
this.dataForm.plannedStartDate = this.dataForm.localDateTimes[0]
|
this.dataForm.plannedFinishDate = this.dataForm.localDateTimes[1]
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
putObj(this.dataForm)
|
.then((data) => {
|
this.$message.success('修改成功')
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
} else {
|
addObj(this.dataForm)
|
.then((data) => {
|
this.$message.success('添加成功')
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
},
|
// 确定并物料预留
|
dataFormSubmitReserved() {
|
this.isSubmit = true
|
this.dataForm.plannedStartDate = this.dataForm.localDateTimes[0]
|
this.dataForm.plannedFinishDate = this.dataForm.localDateTimes[1]
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
putObj(this.dataForm)
|
.then((data) => {
|
console.log(data)
|
this.$message.success('修改成功')
|
this.$router.push({
|
path: '../operationtaskreserved/index',
|
query: { optaskNo: data.data.data }
|
})
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
} else {
|
addObj(this.dataForm)
|
.then((data) => {
|
console.log(data)
|
this.$message.success('添加成功')
|
this.$router.push({
|
path: '../operationtaskreserved/index',
|
query: { optaskNo: data.data.data }
|
})
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
},
|
// 根据工艺工序切换零件
|
selectChangedRoutingOperation(moRoutingOperationId) {
|
const routingOperation = this.routingOptions.find(
|
(item) => item.id == moRoutingOperationId
|
)
|
console.log(routingOperation)
|
this.dataForm.partName = routingOperation.partName
|
this.dataForm.partNo = routingOperation.partNo
|
this.dataForm.partId = routingOperation.partId
|
this.dataForm.unit = routingOperation.unit
|
this.dataForm.sunit = routingOperation.sunit
|
this.setPlannedQuantityAndDisNum()
|
|
this.dataForm.operationName = routingOperation.operationName
|
this.dataForm.workCenter = routingOperation.workCenter
|
this.changeWorkCenter()
|
this.dataForm.routingOperationId =
|
routingOperation.technologyRoutingOperationId
|
},
|
|
// 根据工作站切换库位
|
selectLocationByWorkstation() {
|
this.locationOptions = []
|
this.dataForm.locationId = null
|
this.selectLocationByWorkstationAction()
|
},
|
selectLocationByWorkstationAction() {
|
if (!this.dataForm.workstationId) {
|
return
|
}
|
var queryParamLocation = Object.assign({
|
workstationId: this.dataForm.workstationId,
|
locationType: 4
|
})
|
fetchListExt(queryParamLocation).then((response) => {
|
const resData = response.data.data.records
|
if (resData && resData.length > 0) {
|
this.locationOptions = resData
|
if (resData.length == 1) {
|
if (this.dataForm.locationId == null) {
|
this.dataForm.locationId = resData[0].id
|
}
|
}
|
}
|
})
|
if (!this.dataForm.partId) {
|
this.$message.error('零件不能为空')
|
return
|
}
|
if (!this.dataForm.plannedQuantity) {
|
this.$message.error('计划数量不能为空')
|
return
|
}
|
calOperationTaskTime(
|
this.dataForm.partId,
|
this.dataForm.plannedQuantity,
|
this.dataForm.workstationId
|
).then((res) => {
|
this.dataForm.taskTheoreticalTime = res.data.data.taskTheoreticalTime
|
this.dataForm.localDateTimes = []
|
this.dataForm.localDateTimes[0] = res.data.data.plannedStartDate
|
this.dataForm.localDateTimes[1] = res.data.data.plannedFinishDate
|
this.dataForm.localDateTimes = [
|
res.data.data.plannedStartDate,
|
res.data.data.plannedFinishDate
|
]
|
this.tattimeList()
|
this.operationTasks = {
|
end_date: this.dataForm.localDateTimes[1],
|
id: '-1',
|
optaskNo: 'templateNo',
|
parent: this.dataForm.workstationId,
|
partName: this.dataForm.partName,
|
quantity: this.dataForm.plannedQuantity,
|
start_date: this.dataForm.localDateTimes[0],
|
state: 'scene',
|
text: this.dataForm.operationName,
|
plannedQuantity: this.dataForm.plannedQuantity,
|
partNo: this.dataForm.partNo
|
}
|
|
this.$nextTick(() => {
|
this.$refs.ganttIndex.show(this.operationTasks)
|
console.log(this.operationTasks)
|
})
|
})
|
},
|
automaticScheduling() {
|
if (!this.dataForm.partId) {
|
this.$message.error('零件不能为空')
|
return
|
}
|
if (!this.dataForm.plannedQuantity) {
|
this.$message.error('计划数量不能为空')
|
return
|
}
|
if (!this.dataForm.workCenter) {
|
this.$message.error('工作中心不能为空')
|
return
|
}
|
autoSetTime(
|
this.dataForm.partId,
|
this.dataForm.workCenter,
|
this.dataForm.plannedQuantity
|
).then((res) => {
|
console.log(res)
|
this.dataForm.localDateTimes = [
|
res.data.data.plannedStartDate,
|
res.data.data.plannedFinishDate
|
]
|
this.dataForm.workstationId = res.data.data.workstationId
|
this.dataForm.taskTheoreticalTime = res.data.data.taskTheoreticalTime
|
this.tattimeList()
|
this.operationTasks = {
|
end_date: this.dataForm.localDateTimes[1],
|
id: '-1',
|
optaskNo: 'templateNo',
|
parent: this.dataForm.workstationId,
|
partName: this.dataForm.partName,
|
quantity: this.dataForm.plannedQuantity,
|
start_date: this.dataForm.localDateTimes[0],
|
state: 'scene',
|
text: this.dataForm.operationName,
|
plannedQuantity: this.dataForm.plannedQuantity,
|
partNo: this.dataForm.partNo
|
}
|
this.$nextTick(() => {
|
this.$refs.ganttIndex.show(this.operationTasks)
|
})
|
})
|
},
|
selectChangedplannedDate() {
|
if (this.dataForm.localDateTimes && this.dataForm.taskTheoreticalTime) {
|
this.tattimeList()
|
}
|
this.operationTasks = {
|
end_date: this.dataForm.localDateTimes[1],
|
id: '-1',
|
optaskNo: 'templateNo',
|
parent: this.dataForm.workstationId,
|
partName: this.dataForm.partName,
|
quantity: this.dataForm.plannedQuantity,
|
start_date: this.dataForm.localDateTimes[0],
|
state: 'scene',
|
text: this.dataForm.operationName,
|
plannedQuantity: this.dataForm.plannedQuantity,
|
partNo: this.dataForm.partNo
|
}
|
this.$nextTick(() => {
|
this.$refs.ganttIndex.show(this.operationTasks)
|
})
|
},
|
tattimeList() {
|
const tattime =
|
new Date(this.dataForm.localDateTimes[1]).getTime() -
|
new Date(this.dataForm.localDateTimes[0]).getTime()
|
this.tattimes = tattime / 60000
|
this.tattimest = false
|
if (this.tattimes >= this.dataForm.taskTheoreticalTime) {
|
this.tattimest = false
|
} else {
|
this.tattimest = true
|
this.$message.error('计划时间不能满足工单加工时间')
|
}
|
},
|
|
// 根据制造订单、零件,查询出Bom零件理论用量、盘数,并进行赋值
|
setPlannedQuantityAndDisNum() {
|
const reqParam = {
|
id: this.dataForm.moId,
|
partId: this.dataForm.partId
|
}
|
getQpaNumber(reqParam).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
const dataList = resData.data
|
if (dataList.length > 0) {
|
let discNum = 0
|
let plannedQuantity = 0
|
for (let i = 0; i < dataList.length; i++) {
|
if (dataList[i].discNum != null) {
|
discNum += dataList[i].discNum
|
}
|
if (dataList[i].qpa != null) {
|
plannedQuantity += dataList[i].qpa
|
}
|
}
|
this.dataForm.discNum = discNum
|
this.dataForm.plannedQuantity = Number(
|
highPrecisionMul(plannedQuantity, this.qtyRequired)
|
).toFixed(6)
|
}
|
}
|
})
|
},
|
// 工序参数集模板的选中结果返回
|
selectOperationTemplate(param) {
|
if (param.length > 0) {
|
const promiseList = []
|
param.forEach((e) => {
|
promiseList.push(
|
new Promise((resolve, reject) => {
|
getOperationParam(
|
Object.assign({
|
current: 1,
|
size: 999,
|
technologyOperationTemplateId: e.id
|
})
|
).then((response) => {
|
this.dataForm.operationTemplateList.push(
|
Object.assign({
|
operationTemplateNo: e.templateNo,
|
operationTemplateName: e.templateName,
|
operationTemplateType: e.templateType,
|
dataType: e.dataType,
|
approvalStatus: '01',
|
paramList: response.data.data.records
|
})
|
)
|
})
|
})
|
)
|
})
|
|
Promise.all(promiseList).then((res) => {})
|
}
|
},
|
// 弹出基础参数集模板对话框
|
openTempalteDialog() {
|
this.showOperationTemplate = true
|
},
|
// 删除参数集
|
handleTemplateDelete(row, index) {
|
this.dataForm.operationTemplateList.splice(index, 1)
|
this.routingTemplate = null
|
this.templateParamList = []
|
this.$message.success('删除成功')
|
},
|
// 参数集点击事件
|
templateRowClick(row) {
|
this.routingTemplate = row
|
this.templateParamList = row.paramList
|
this.checkApproveStatus(row.approvalStatus)
|
},
|
// 获取工序参数类型
|
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
|
}
|
}
|
},
|
// 根据选中的参数集审核状态判断是否可以修改
|
checkApproveStatus(approvalStatus) {
|
if (
|
approvalStatus &&
|
(approvalStatus === '02' || approvalStatus === '03')
|
) {
|
this.unapproved = false
|
} else {
|
this.unapproved = true
|
}
|
},
|
// 弹出基础工序参数对话框
|
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(params) {
|
if (params.length > 0) {
|
params.forEach((param) => {
|
this.templateParamList.push(param)
|
})
|
this.$message.success('添加成功')
|
}
|
},
|
// 删除参数
|
handleParamDelete(row, index) {
|
this.templateParamList.splice(index, 1)
|
this.$message.success('删除成功')
|
}
|
}
|
}
|
</script>
|