<template>
|
<div class="mod-config">
|
<basic-container>
|
<ttable
|
:table="table"
|
@currentChange="handleCurrentChange"
|
@handleSelectionChange="handleSelectionChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:ajaxFun="ajaxFun"
|
:paramObj="paramObj"
|
ref="manufacturingOrderTable"
|
>
|
<template #toolbar>
|
<el-dropdown
|
v-if="permissions.manufacturingorder_create_task"
|
@command="taskTypeHandleCommand"
|
>
|
<el-button>
|
工单<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:key="index"
|
:command="item.command"
|
v-for="(item,index) in taskTypeArr"
|
:disabled="canCreateTask"
|
>{{ item.label }}</el-dropdown-item
|
>
|
</el-dropdown-menu>
|
</el-dropdown>
|
|
<el-dropdown
|
v-if="permissions.manufacturingorder_state_change"
|
@command="handleCommand"
|
style="margin-left:10px;"
|
>
|
<el-button>
|
状态变更<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:key="index"
|
:command="item.command"
|
v-for="(item,index) in stateTagArr"
|
:disabled="item.disabled"
|
>{{ item.label }}</el-dropdown-item
|
>
|
</el-dropdown-menu>
|
</el-dropdown>
|
|
<!-- <el-dropdown
|
v-if="permissions.manufacturingorder_issue_material"
|
@command="issueMaterialHandleCommand"
|
style="margin-left:10px;"
|
> -->
|
<!-- <el-button>
|
发料<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button> -->
|
<!-- <el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:command="item.command"
|
v-for="item in issueMaterialArr"
|
:disabled="item.disabled"
|
>{{ item.label }}</el-dropdown-item
|
>
|
</el-dropdown-menu> -->
|
<!-- </el-dropdown> -->
|
<!-- <el-button
|
v-if="permissions.manufacturingorder_orderto_ifs"
|
@click="commitOrderIfs()"
|
type="primary"
|
style="margin-left:10px;"
|
:loading="loadingOrderIfs"
|
>订单同步ERP
|
</el-button>
|
<el-button
|
v-if="permissions.manufacturingorder_techto_ifs"
|
@click="commitTechIfs()"
|
type="primary"
|
style="margin-left:10px;"
|
:loading="loadingTechIfs"
|
>工艺同步ERP
|
</el-button>
|
<el-button
|
v-if="permissions.manufacturingorder_materialto_ifs"
|
@click="commitStructIfs()"
|
type="primary"
|
style="margin-left:10px;"
|
:loading="loadingStructIfs"
|
>物料同步ERP
|
</el-button> -->
|
<!-- <el-button
|
v-if="permissions.manufacturingorder_refresh_ifsorder"
|
@click="refreshIfsorder()"
|
type="primary"
|
style="margin-left:10px;"
|
:loading="refreshIfsorderLoading"
|
>刷新ifs车间订单号
|
</el-button> -->
|
|
<el-button
|
@click="exportExcel"
|
type="primary"
|
style="margin-left:10px;"
|
:loading="loadingExcel"
|
>导出
|
</el-button>
|
<el-button
|
v-if="permissions.manufacturingorder_update_orderno"
|
@click="updateOrderNo"
|
type="primary"
|
style="margin-left:10px;"
|
>更新订单号
|
</el-button>
|
</template>
|
</ttable>
|
<customerorder
|
:currshowlist.sync="showCustomerorder"
|
@handleSelectionChange="selectCustomerorder"
|
></customerorder>
|
<!-- 弹窗, 新增 / 修改 -->
|
<operation-task
|
v-if="operationTaskVisible"
|
ref="operationTask"
|
@refreshDataList="getData"
|
></operation-task>
|
|
<!-- 弹窗, 工单列表 -->
|
<AutoOperationtask
|
:currshowlist.sync="showAutoOperation"
|
:orderId="orderId"
|
:outPutBatchList="selectedOutPutBatchList"
|
:qtyPlaned="qtyPlaned"
|
:selection-array="multipleSelection"
|
@refreshDataList="getData"
|
></AutoOperationtask>
|
<!-- 弹窗, 发料页面 -->
|
<IssueMaterialForm
|
:currshowlist.sync="showIssueMaterial"
|
:issueOrder="issueOrder"
|
></IssueMaterialForm>
|
<!-- 弹窗, 订单合并页面 -->
|
<OrderMergeForm
|
:currshowlist.sync="showOrderMerge"
|
:orderList="multipleSelection"
|
@refreshDataList="getData"
|
></OrderMergeForm>
|
<!--产出批次-->
|
<!--<OutPutBatch
|
:currshowlist.sync="showOutPutBatch"
|
:createOrderType="createOrderType"
|
:outPutBatchList="outPutBatchList"
|
@returnBatchData="returnBatchData"
|
></OutPutBatch>-->
|
<!-- 取消直接发料 -->
|
<DelMatUnIssueVue ref="DelMatUnIssueVue" @refreshDataList="getData" />
|
<el-dialog
|
title="导入"
|
:visible.sync="importUpdateOrderNoVisible"
|
width="30%"
|
>
|
<span>
|
<div style="display:flex;justify-content:space-around;">
|
<div>
|
<el-upload
|
style="margin-left:8px;display: inline;"
|
class="upload-demo"
|
drag
|
:headers="headers"
|
:action="updateOrderNoUrl"
|
:beforeUpload="beforeAvatarUpload"
|
:limit="1"
|
:show-file-list="false"
|
:file-list="updateOrderNoFileList"
|
:on-success="updateOrderNoFileSuccessUploadScan"
|
:on-error="handleError"
|
accept=".xlsx,.xls,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
:auto-upload="true"
|
ref="updateOrderNoUploadScan"
|
multiple
|
>
|
<i class="el-icon-upload"></i>
|
<div class="el-upload__text"><em>导入订单号更新数据</em></div>
|
<div class="el-upload__tip" slot="tip">
|
只能上传xlsx/xls文件,且不超过10M
|
</div>
|
</el-upload>
|
</div>
|
</div>
|
</span>
|
</el-dialog>
|
</basic-container>
|
</div>
|
</template>
|
|
<script>
|
import {
|
fetchListManufacturingOrder,
|
importShopOrderStd,
|
modifyShopOperationStd,
|
modifyShopMaterialAllocStd,
|
mergeCheck,
|
manufacturingOrderExport,
|
refreshIfsOrderNo
|
} from '@/api/plan/manufacturingorder'
|
import { delMatUnIssue } from '@/api/plan/issuematerial'
|
import { mapGetters } from 'vuex'
|
import ttable from '@/views/common/ztt-table.vue'
|
import { changeState } from '../../../api/plan/manufacturingorder'
|
import OperationTask from '@/views/plan/operationtask/operationtask-form'
|
import Customerorder from '@/views/common/customerorder.vue'
|
import AutoOperationtask from './auto-operationtask.vue'
|
import IssueMaterialForm from './issue-material-form.vue'
|
import OrderMergeForm from './order-merge.vue'
|
import { remote } from '@/api/admin/dict'
|
import { getByMoIds } from '@/api/plan/operationtaskproduce'
|
import { transform } from '@/util/fileTransform'
|
import DelMatUnIssueVue from './DelMatUnIssue.vue'
|
import { getStore } from '@/util/store.js'
|
import { getObj as getSysParam } from '@/api/admin/sys-public-param'
|
export default {
|
data() {
|
return {
|
showCustomerorder: false,
|
paramObj: { customerList: null },
|
customerOrder: null,
|
ajaxFun: fetchListManufacturingOrder,
|
currentRow: null,
|
operationTaskVisible: false,
|
taskTypeArr: [],
|
stateTagArr: [
|
{
|
label: '待下达',
|
command: 'PLAN',
|
disabled: false,
|
permitArr: ['03completed', '04canceled']
|
},
|
{
|
label: '已下达',
|
command: 'COMMAND',
|
disabled: false,
|
permitArr: ['03completed', '04canceled', '01planned']
|
},
|
{
|
label: '已完成',
|
command: 'COMPLETE',
|
disabled: false,
|
permitArr: ['01planned', '02issued', '04canceled']
|
},
|
{
|
label: '已取消',
|
command: 'CANCEL',
|
disabled: false,
|
permitArr: ['01planned', '02issued', '03completed']
|
}
|
],
|
issueMaterialArr: [
|
{
|
label: '直接发料',
|
command: 'START',
|
disabled: false,
|
permitArr: []
|
},
|
{
|
label: '取消直接发料',
|
command: 'CANCEL',
|
disabled: false,
|
permitArr: []
|
}
|
],
|
states: [
|
{ value: '01planned', label: '待下达' },
|
{ value: '02issued', label: '已下达' },
|
{
|
value: '03completed',
|
label: '已完成'
|
},
|
{ value: '04canceled', label: '已取消' }
|
],
|
status: [
|
{
|
value: true,
|
label: '已确认'
|
},
|
{
|
value: false,
|
label: '未确认'
|
}
|
],
|
multipleSelection: [],
|
isShowQuery: false,
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
dateTimeFilters: {},
|
prelang: 'operation',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: true, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮H
|
isSearch: true, // 高级查询按钮
|
defaultOrderBy: { column: 'createTime', direction: 'desc' }
|
},
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
minWidth: '140',
|
prop: 'state',
|
label: '状态',
|
sort: true,
|
isTrue: true,
|
formatter: this.formatState,
|
// propVal: '01planned',
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.states
|
}
|
},
|
{
|
minWidth: '100',
|
prop: 'workShop',
|
label: '车间',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '100',
|
prop: 'operationNames',
|
label: '车间订单工序',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '100',
|
prop: 'currentOperation',
|
label: '当前工序',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
// render: { fun: this.addOrUpdateHandle }
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue === '绝缘') {
|
formatVal =
|
'<div style="background-color:orange;color: #fff;">' +
|
cellValue +
|
'</div>'
|
} else if (cellValue === '成缆') {
|
formatVal =
|
'<div style="background-color:blue;color: #fff;">' +
|
cellValue +
|
'</div>'
|
} else if (cellValue === '护套') {
|
formatVal =
|
'<div style="background-color:red;color: #fff;">' +
|
cellValue +
|
'</div>'
|
} else {
|
formatVal = '<span>' + cellValue ? cellValue : '' + '</span>'
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'customerOrderNo',
|
label: '订单号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'customerName',
|
label: '客户名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'mpsNo',
|
label: '生产计划号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// {
|
// minWidth: '120',
|
// prop: 'printRequirement',
|
// label: '印字要求',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
// {
|
// minWidth: '120',
|
// prop: 'lengthRequirement',
|
// label: '盘长要求',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
{
|
minWidth: '120',
|
prop: 'orderRemark',
|
label: '销售订单备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// 车间订单类型
|
{
|
minWidth: '120',
|
prop: 'workshopTypeCode',
|
label: '车间订单类型',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatBomTypeDbType,
|
optList: () => {
|
return this.bomTypeDbOptions
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'moNo',
|
label: '车间订单号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
render: { fun: this.addOrUpdateHandle }
|
},
|
{
|
minWidth: '120',
|
prop: 'manufactureAttr',
|
label: '制造属性',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.getManufactureAttr,
|
optList: () => {
|
return this.manufactureAttrs
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'partNo',
|
label: '零件号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'partName',
|
label: '零件名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// {
|
// minWidth: '120',
|
// prop: 'outerColor',
|
// label: '外护颜色',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
|
// {
|
// minWidth: '120',
|
// prop: 'insulationColor',
|
// label: '绝缘颜色',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
{
|
minWidth: '120',
|
prop: 'qtyRequired',
|
label: '需求数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'qtyFinished',
|
label: '完成数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '130',
|
prop: 'ratio',
|
label: '完成进度(%)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'unit',
|
label: '单位',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '140',
|
width: '120',
|
prop: 'requiredDate',
|
label: '需求日期',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange',
|
formatter: this.formatDutyDate
|
},
|
{
|
minWidth: '120',
|
prop: 'bomConfirmStatus',
|
label: 'BOM状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.status
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue) {
|
formatVal = '已确认'
|
} else {
|
formatVal = '未确认'
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'processConfirmStatus',
|
label: '工艺状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.status
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue) {
|
formatVal = '已确认'
|
} else {
|
formatVal = '未确认'
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'standardConfirmStatus',
|
label: '检测标准状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.status
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue) {
|
formatVal = '已确认'
|
} else {
|
formatVal = '未确认'
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '200',
|
prop: 'remark',
|
label: '车间订单备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
// {
|
// minWidth: '100',
|
// prop: 'oriIfsOrderNo',
|
// label: '原IFS订单号',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
// {
|
// minWidth: '100',
|
// prop: 'ifsOrderNo',
|
// label: 'IFS订单号',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
// {
|
// minWidth: '100',
|
// prop: 'ifsReleaseNo',
|
// label: 'IFS下达号',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
// {
|
// minWidth: '100',
|
// prop: 'ifsSequenceNo',
|
// label: 'IFS序列号',
|
// sort: true,
|
// isTrue: true,
|
// isSearch: true,
|
// searchInfoType: 'text'
|
// },
|
{
|
minWidth: '100',
|
prop: 'qtyApply',
|
label: '申请数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '140',
|
width: '120',
|
prop: 'startDate',
|
label: '开始日期',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange',
|
formatter: this.formatDutyDate
|
},
|
{
|
minWidth: '140',
|
width: '120',
|
prop: 'endDate',
|
label: '到期时间',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange',
|
formatter: this.formatDutyDate
|
},
|
{
|
minWidth: '120',
|
prop: 'ifsSync',
|
label: '订单同步ERP',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.syncStatus
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue != null) {
|
if (cellValue) {
|
formatVal = '是'
|
} else {
|
formatVal = '否'
|
}
|
} else {
|
formatVal = ''
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'ifsRoutingOperationSync',
|
label: '工艺同步ERP',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.operationSyncStatus
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue != null) {
|
if (cellValue) {
|
formatVal = '是'
|
} else {
|
formatVal = '否'
|
}
|
} else {
|
formatVal = ''
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'ifsMatSync',
|
label: '物料同步ERP',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.matSyncStatus
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue != null) {
|
if (cellValue) {
|
formatVal = '是'
|
} else {
|
formatVal = '否'
|
}
|
} else {
|
formatVal = ''
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '100',
|
prop: 'factoryName',
|
label: '工厂',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '140',
|
width: '120',
|
prop: 'updateTime',
|
label: '更新时间',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange',
|
formatter: this.formatDutyDate
|
},
|
{
|
minWidth: '100',
|
prop: 'updateUser',
|
label: '更新人',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '140',
|
width: '120',
|
prop: 'createTime',
|
label: '创建时间',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange',
|
formatter: this.formatDutyDate
|
},
|
{
|
minWidth: '100',
|
prop: 'createUser',
|
label: '创建人',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
],
|
toolbar: [],
|
operator: null,
|
operatorConfig: {
|
fixed: 'right',
|
label: '操作',
|
width: 100,
|
minWidth: 100
|
}
|
},
|
loadingOrderIfs: false,
|
loadingTechIfs: false,
|
loadingStructIfs: false,
|
loadingExcel: false,
|
refreshIfsorderLoading: false,
|
orderId: null,
|
showAutoOperation: false,
|
showIssueMaterial: false,
|
issueOrder: null,
|
bomTypeDbOptions: [],
|
syncStatus: [
|
{
|
value: true,
|
label: '是'
|
},
|
{
|
value: false,
|
label: '否'
|
}
|
],
|
matSyncStatus: [
|
{
|
value: true,
|
label: '是'
|
},
|
{
|
value: false,
|
label: '否'
|
}
|
],
|
operationSyncStatus: [
|
{
|
value: true,
|
label: '是'
|
},
|
{
|
value: false,
|
label: '否'
|
}
|
],
|
showOrderMerge: false,
|
manufactureAttrs: [],
|
orderPlan: null,
|
createOrderType: 'MANUAL',
|
outPutBatchList: [],
|
selectedOutPutBatchList: [],
|
qtyPlaned: 0,
|
canCreateTask: false,
|
importUpdateOrderNoVisible: false,
|
headers: {
|
Authorization: 'Bearer ' + getStore({ name: 'access_token' })
|
},
|
updateOrderNoUrl: '/mes/plan/manufacturingOrder/uploadRefreshIfsOrderNo',
|
updateOrderNoFileList: [],
|
MO_IFS_NEED_SYNC: false // 系统参数-车间订单是否同步IFS
|
}
|
},
|
components: {
|
Customerorder,
|
OperationTask,
|
ttable,
|
AutoOperationtask,
|
IssueMaterialForm,
|
OrderMergeForm,
|
DelMatUnIssueVue
|
},
|
created() {
|
this.getManufactureAttrs()
|
/**
|
* {
|
text: '新增',
|
type: 'primary',
|
fun: this.addOrUpdateHandle
|
},
|
{
|
text: '按客户订单查询',
|
fun: this.getOperationTaskByCustomer
|
},
|
{
|
text: '订单合并',
|
fun: this.openOrderMerge
|
}
|
*/
|
if (this.permissions.plan_manufacturingorder_add) {
|
this.table.toolbar.push({
|
text: '新增',
|
type: 'primary',
|
fun: this.addOrUpdateHandle
|
})
|
}
|
if (this.permissions.manufacturingorder_queryby_customerorder) {
|
this.table.toolbar.push({
|
text: '按客户订单查询',
|
fun: this.getOperationTaskByCustomer
|
})
|
}
|
if (this.permissions.manufacturingorder_order_merge) {
|
this.table.toolbar.push({
|
text: '订单合并',
|
fun: this.openOrderMerge
|
})
|
}
|
|
/**
|
* {
|
label: '手动新增',
|
command: 'MANUAL',
|
disabled: false,
|
permitArr: ['01planned', '02issued']
|
},
|
{
|
label: '自动新增',
|
command: 'AUTO',
|
disabled: false,
|
permitArr: ['01planned', '02issued']
|
}
|
*/
|
|
if (this.permissions.manufacturingorder_create_task_manual) {
|
this.taskTypeArr.push({
|
label: '手动新增',
|
command: 'MANUAL',
|
disabled: false,
|
permitArr: ['01planned', '02issued']
|
})
|
}
|
if (this.permissions.manufacturingorder_create_task_auto) {
|
this.taskTypeArr.push({
|
label: '自动新增',
|
command: 'AUTO',
|
disabled: false,
|
permitArr: ['01planned', '02issued']
|
})
|
}
|
// 初始化queryParam
|
// this.initSearchCondition()
|
// if (!this.options.cancelRunCreated) {
|
// this.getDataList()
|
// }
|
// const queryParam = []
|
// queryParam.push(
|
// Object.assign({
|
// prop: 'state',
|
// searchInfoType: 'select',
|
// propVal: '01planned'
|
// })
|
// )
|
// this.$refs.manufacturingOrderTable.setQueryParam(queryParam)
|
// this.getData()
|
this.getBomTypeDbOptions()
|
|
// 车间订单是否同步IFS
|
getSysParam('MO_IFS_NEED_SYNC').then((response) => {
|
var paramVal = response.data.data
|
if (response.data.code === 0) {
|
if (paramVal != null && paramVal === 'true') {
|
this.MO_IFS_NEED_SYNC = true
|
} else {
|
this.MO_IFS_NEED_SYNC = false
|
}
|
} else {
|
this.MO_IFS_NEED_SYNC = false
|
}
|
})
|
},
|
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
activated() {
|
this.getData()
|
},
|
mounted() {
|
// this.initQueryParams()
|
},
|
methods: {
|
getManufactureAttr(row, column, cellValue) {
|
this.manufactureAttrs.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
},
|
getManufactureAttrs() {
|
remote('manufacture_attr_type').then((response) => {
|
if (response.data.code === 0) {
|
this.manufactureAttrs = response.data.data
|
} else {
|
this.manufactureAttrs = []
|
}
|
})
|
},
|
initQueryParams() {
|
const queryParam = []
|
// queryParam.push(
|
// Object.assign({
|
// prop: 'state',
|
// searchInfoType: 'select',
|
// propVal: '01planned'
|
// })
|
// )
|
this.$refs.manufacturingOrderTable.setQueryParam(queryParam)
|
this.getData()
|
},
|
// 获取数据列表
|
getData() {
|
this.$refs.manufacturingOrderTable.getDataList()
|
},
|
getOperationTaskByCustomer() {
|
this.showCustomerorder = true
|
},
|
selectCustomerorder(param) {
|
if (param.length > 0 && param) {
|
var idList = param.map(function(value, index) {
|
return value.id
|
})
|
this.paramObj = { customerList: idList }
|
this.$nextTick(() => {
|
this.getData()
|
})
|
} else {
|
this.paramObj = { customerList: null }
|
this.$nextTick(() => {
|
this.getData()
|
})
|
}
|
},
|
createOperationTask() {
|
if (this.multipleSelection.length == 1) {
|
this.operationTaskVisible = true
|
} else {
|
if (this.multipleSelection.length > 1) {
|
this.$message.error('请选择一条车间订单')
|
return
|
}
|
this.$message.error('请选择车间订单')
|
return
|
}
|
this.$nextTick(() => {
|
this.$refs.operationTask.init(0, this.multipleSelection[0])
|
})
|
},
|
formatDutyDate(row, column, cellValue) {
|
if (cellValue) {
|
const dutyDateList = /\d{4}-\d{1,2}-\d{1,2}/g.exec(cellValue)
|
if (dutyDateList && dutyDateList.length > 0) {
|
return dutyDateList[0]
|
}
|
}
|
return ''
|
},
|
handleCurrentChange(row) {
|
this.currentRow = row
|
},
|
// 新增 / 修改
|
addOrUpdateHandle(row) {
|
this.$router.push({
|
name: 'productorderForm',
|
query: { id: row == null ? null : row.id }
|
})
|
/* this.$nextTick(() => {
|
this.$refs.addOrUpdate.init(row ? row.id : row,row ? row.state : row)
|
}) */
|
},
|
// 表格字段格式化
|
formatState(row, column, cellValue) {
|
for (let i = 0, len = this.states.length; i < len; i++) {
|
if (cellValue == this.states[i].value) {
|
return this.states[i].label
|
}
|
}
|
},
|
// 创建工单
|
taskTypeHandleCommand(event) {
|
if (event === 'MANUAL') {
|
// 手动新增
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.orderPlan = this.multipleSelection[0]
|
if (
|
this.orderPlan.state != null &&
|
(this.orderPlan.state == '01planned' ||
|
this.orderPlan.state == '02issued')
|
) {
|
if (!this.MO_IFS_NEED_SYNC) {
|
// 根据车间订单id,查询对应的产出批次
|
getByMoIds([this.orderPlan.id]).then((repsonse) => {
|
const resData = repsonse.data.data
|
const resCode = repsonse.data.code
|
if (resCode === 0) {
|
const _that = this
|
for (const key in resData) {
|
resData[key].forEach((item) => {
|
if (item.operationTaskId != null) {
|
_that.$set(item, 'commonChecked', false)
|
} else {
|
_that.$set(item, 'commonChecked', true)
|
}
|
})
|
}
|
this.operationTaskVisible = true
|
this.$nextTick(() => {
|
this.$refs.operationTask.init(
|
0,
|
this.orderPlan,
|
this.selectedOutPutBatchList,
|
this.qtyPlaned
|
)
|
})
|
}
|
})
|
} else {
|
// 先进行ifs同步
|
this.canCreateTask = true
|
importShopOrderStd([this.orderPlan.id])
|
.then((resTask) => {
|
const resTaskData = resTask.data
|
if (resTaskData.code === 0) {
|
this.$message.success('订单同步ERP成功!')
|
// 根据车间订单id,查询对应的产出批次
|
getByMoIds([this.orderPlan.id]).then((repsonse) => {
|
const resData = repsonse.data.data
|
const resCode = repsonse.data.code
|
if (resCode === 0) {
|
const _that = this
|
for (const key in resData) {
|
resData[key].forEach((item) => {
|
if (item.operationTaskId != null) {
|
_that.$set(item, 'commonChecked', false)
|
} else {
|
_that.$set(item, 'commonChecked', true)
|
}
|
})
|
}
|
|
this.operationTaskVisible = true
|
this.$nextTick(() => {
|
this.$refs.operationTask.init(
|
0,
|
this.orderPlan,
|
this.selectedOutPutBatchList,
|
this.qtyPlaned
|
)
|
})
|
}
|
})
|
} else {
|
this.$message.error('订单同步ERP失败!')
|
}
|
this.canCreateTask = false
|
})
|
.catch(() => {
|
this.canCreateTask = false
|
})
|
}
|
} else {
|
this.$message.error(
|
'只有【状态】为‘已计划、已下达’的车间订单,才能进行工单的新增'
|
)
|
}
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
} else {
|
// 自动新增,弹出自动新增的页面
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.orderPlan = this.multipleSelection[0]
|
if (
|
this.orderPlan.state != null &&
|
(this.orderPlan.state == '01planned' ||
|
this.orderPlan.state == '02issued')
|
) {
|
if (!this.MO_IFS_NEED_SYNC) {
|
this.orderId = this.orderPlan.id
|
// 根据车间订单id,查询对应的产出批次
|
getByMoIds([this.orderPlan.id]).then((repsonse) => {
|
const resData = repsonse.data.data
|
const resCode = repsonse.data.code
|
if (resCode === 0) {
|
const _that = this
|
for (const key in resData) {
|
resData[key].forEach((item) => {
|
if (item.operationTaskId != null) {
|
_that.$set(item, 'commonChecked', false)
|
} else {
|
_that.$set(item, 'commonChecked', true)
|
}
|
})
|
}
|
this.showAutoOperation = true
|
}
|
})
|
} else {
|
// 先进行ifs同步
|
this.canCreateTask = true
|
importShopOrderStd([this.orderPlan.id])
|
.then((resTask) => {
|
const resTaskData = resTask.data
|
if (resTaskData.code === 0) {
|
this.$message.success('订单同步ERP成功!')
|
this.orderId = this.orderPlan.id
|
// 根据车间订单id,查询对应的产出批次
|
getByMoIds([this.orderPlan.id]).then((repsonse) => {
|
const resData = repsonse.data.data
|
const resCode = repsonse.data.code
|
if (resCode === 0) {
|
const _that = this
|
for (const key in resData) {
|
resData[key].forEach((item) => {
|
if (item.operationTaskId != null) {
|
_that.$set(item, 'commonChecked', false)
|
} else {
|
_that.$set(item, 'commonChecked', true)
|
}
|
})
|
}
|
|
this.showAutoOperation = true
|
}
|
})
|
} else {
|
this.$message.error('订单同步ERP失败!')
|
}
|
this.canCreateTask = false
|
})
|
.catch(() => {
|
this.canCreateTask = false
|
})
|
}
|
} else {
|
this.$message.error(
|
'只有【状态】为‘已计划、已下达’的车间订单,才能进行工单的新增'
|
)
|
}
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
}
|
},
|
// 选中产出批次时的,回调
|
returnBatchData(selectedObj) {
|
//
|
this.selectedOutPutBatchList = selectedObj.outPutBatchList
|
this.qtyPlaned = selectedObj.qtyPlaned
|
if (selectedObj.createOrderType === 'MANUAL') {
|
this.operationTaskVisible = true
|
this.$nextTick(() => {
|
this.$refs.operationTask.init(
|
0,
|
this.orderPlan,
|
this.selectedOutPutBatchList,
|
this.qtyPlaned
|
)
|
})
|
} else if (selectedObj.createOrderType === 'AUTO') {
|
this.showAutoOperation = true
|
}
|
},
|
// 状态改变
|
handleCommand(event) {
|
var eventName
|
if (event == 'PLAN') {
|
eventName = '已计划'
|
} else if (event == 'COMMAND') {
|
eventName = '已下达'
|
} else if (event == 'COMPLETE') {
|
eventName = '已完成'
|
} else {
|
eventName = '已取消'
|
}
|
if (this.multipleSelection.length > 0) {
|
changeState(
|
this.multipleSelection.map((item) => {
|
return item.id
|
}),
|
event
|
).then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success(eventName + '修改成功')
|
this.getData()
|
} else {
|
this.$message.error(eventName + '修改失败')
|
}
|
})
|
} else {
|
this.$message.error('请选择' + eventName + '的对象')
|
}
|
},
|
// 发料
|
issueMaterialHandleCommand(event) {
|
if (event == 'START') {
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.issueOrder = this.multipleSelection[0]
|
this.openIssueMaterials()
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
} else {
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
// this.delMatUnIssue(this.multipleSelection[0].id)
|
this.$refs.DelMatUnIssueVue.init(this.multipleSelection[0].id)
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
}
|
},
|
// table自带事件
|
handleSelectionChange(val) {
|
// 根据状态,禁用表头按钮
|
// 筛选出选中记录的状态
|
var stateArr = val.map(function(value, index) {
|
return value.state
|
})
|
// 选中状态数组元素去重
|
var uniqueStateArr = []
|
for (var i = 0; i < stateArr.length; i++) {
|
if (uniqueStateArr.indexOf(stateArr[i]) == -1) {
|
uniqueStateArr.push(stateArr[i])
|
}
|
}
|
// 循环自定义按钮,判断每个按钮的permitArr是否完全包含选中状态,若完全包含,则按钮亮,否则按钮灰
|
for (var i = 0; i < this.stateTagArr.length; i++) {
|
if (
|
uniqueStateArr.every((val) =>
|
this.stateTagArr[i].permitArr.length <= 0
|
? true
|
: this.stateTagArr[i].permitArr.includes(val)
|
)
|
) {
|
this.stateTagArr[i].disabled = false
|
} else {
|
this.stateTagArr[i].disabled = true
|
}
|
}
|
this.multipleSelection = val
|
},
|
// 同步至Ifs
|
syncIfs() {
|
if (this.multipleSelection.length > 0) {
|
const toolbar = this.table.toolbar.find(
|
(item) => item.text === '同步至IFS'
|
)
|
if (toolbar) {
|
toolbar.loading = true
|
const ids = []
|
this.multipleSelection.forEach((item) => {
|
ids.push(item.id)
|
})
|
importShopOrderStd(ids)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('同步至IFS成功!')
|
this.getData()
|
} else {
|
this.$message.error('同步至IFS失败!')
|
}
|
toolbar.loading = false
|
})
|
.catch(() => {
|
toolbar.loading = false
|
})
|
}
|
} else {
|
this.$message.error('请先勾选车间订单!')
|
}
|
},
|
refreshIfsorder() {
|
this.refreshIfsorderLoading = true
|
refreshIfsOrderNo()
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('刷新ifs车间订单号成功!')
|
this.getData()
|
} else {
|
this.$message.error('刷新ifs车间订单号失败!')
|
}
|
})
|
.finally(() => {
|
this.refreshIfsorderLoading = false
|
})
|
},
|
// 打开发料页面弹窗
|
openIssueMaterials() {
|
this.showIssueMaterial = true
|
},
|
// 取消直接发料
|
delMatUnIssue(moId) {
|
delMatUnIssue(moId).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('取消直接发料成功!')
|
this.getData()
|
} else {
|
this.$message.error('取消直接发料失败!')
|
}
|
})
|
},
|
// 订单同步IFS
|
commitOrderIfs() {
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.loadingOrderIfs = true
|
const ids = []
|
this.multipleSelection.forEach((item) => {
|
ids.push(item.id)
|
})
|
importShopOrderStd(ids)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('订单同步ERP成功!')
|
this.getData()
|
} else {
|
this.$message.error('订单同步ERP失败!')
|
}
|
this.loadingOrderIfs = false
|
})
|
.catch(() => {
|
this.loadingOrderIfs = false
|
})
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
},
|
// 工艺同步IFS
|
commitTechIfs() {
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.loadingTechIfs = true
|
const ids = []
|
this.multipleSelection.forEach((item) => {
|
ids.push(item.id)
|
})
|
modifyShopOperationStd(ids)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('工艺同步ERP成功!')
|
this.getData()
|
} else {
|
this.$message.error('工艺同步ERP失败!')
|
}
|
this.loadingTechIfs = false
|
})
|
.catch(() => {
|
this.loadingTechIfs = false
|
})
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
},
|
// 物料同步IFS
|
commitStructIfs() {
|
if (this.multipleSelection.length == 0) {
|
this.$message.error('请选择车间订单')
|
} else {
|
if (this.multipleSelection.length == 1) {
|
this.loadingStructIfs = true
|
const ids = []
|
this.multipleSelection.forEach((item) => {
|
ids.push(item.id)
|
})
|
modifyShopMaterialAllocStd(ids)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('物料同步ERP成功!')
|
this.getData()
|
} else {
|
this.$message.error('物料同步ERP失败!')
|
}
|
this.loadingStructIfs = false
|
})
|
.catch(() => {
|
this.loadingStructIfs = false
|
})
|
} else {
|
this.$message.error('只能选择一条车间订单')
|
}
|
}
|
},
|
getBomTypeDbOptions() {
|
remote('bom_type_db').then((response) => {
|
if (response.data.code === 0) {
|
this.bomTypeDbOptions = response.data.data
|
} else {
|
this.bomTypeDbOptions = []
|
}
|
})
|
},
|
// 工艺类型中文格式化
|
formatBomTypeDbType(row, column, cellValue) {
|
this.bomTypeDbOptions.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
},
|
// 打开订单合并窗口
|
openOrderMerge() {
|
if (this.multipleSelection.length > 1) {
|
let stateFlag = true
|
const ids = []
|
this.multipleSelection.forEach((obj) => {
|
if (obj.state !== '01planned') {
|
stateFlag = false
|
}
|
ids.push(obj.id)
|
})
|
if (stateFlag) {
|
mergeCheck(ids).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
if (resData.data) {
|
this.showOrderMerge = true
|
} else {
|
this.$message.error('车间订单不一致,无法进行合并')
|
}
|
} else {
|
this.$message.error('车间订单校验异常')
|
}
|
})
|
} else {
|
this.$message.error('订单状态需为已计划')
|
}
|
} else {
|
this.$message.error('请至少选择两条车间订单')
|
}
|
},
|
searchStock(row) {
|
this.$router.push({
|
path: '/warehouse/stock/index',
|
query: { partNo: row.partNo }
|
})
|
},
|
// 导出Excel
|
exportExcel() {
|
this.loadingExcel = true
|
manufacturingOrderExport(
|
this.$refs.manufacturingOrderTable.getQueryParam()
|
)
|
.then((response) => {
|
transform(response)
|
this.loadingExcel = false
|
})
|
.catch(() => {
|
this.loadingExcel = false
|
})
|
},
|
// 更新订单号
|
updateOrderNo() {
|
this.importUpdateOrderNoVisible = true
|
},
|
// 限制文件上传大小,目前限制为10M(另可以加类型限制)
|
beforeAvatarUpload(file) {
|
const fileName = file.name
|
const fileType = fileName.substring(fileName.lastIndexOf('.') + 1)
|
const isLt10M = file.size / 1024 / 1024 < 10
|
if (fileType !== 'xlsx' && fileType !== 'xls') {
|
this.$message.error('文件格式只能为xlsx或xls,请删除后重新上传')
|
}
|
if (!isLt10M) {
|
this.$message({
|
message: '文件大小',
|
type: 'warning'
|
})
|
}
|
return isLt10M
|
},
|
// 文件上传成功回调事件
|
updateOrderNoFileSuccessUploadScan(response, file, fileList) {
|
if (response.code != '0') {
|
this.$message.warning(response.msg)
|
} else {
|
this.$message({
|
message: '上传成功',
|
type: 'success'
|
})
|
this.getData()
|
}
|
this.$refs.updateOrderNoUploadScan.clearFiles()
|
},
|
// 上传失败
|
handleError(err, file, fileList) {
|
const error = JSON.parse(err.message)
|
if (error.msg) {
|
this.$message.error(error.msg)
|
} else {
|
this.$message.error('上传失败')
|
}
|
}
|
}
|
}
|
</script>
|