change - 下达计划页面

main
yinq 5 months ago
parent 3852097234
commit 086e7b3674

@ -60,3 +60,12 @@ export function productionBomTreeList(query) {
params: query
})
}
// 通过生产BOM生成工单
export function generateTickets(query) {
return request({
url: '/mes/prod/prodBomInfo/generateTickets',
method: 'get',
params: query
})
}

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询生产工单列表
export function listProdPlanInfo(query) {
return request({
url: '/mes/prod/prodPlanInfo/list',
method: 'get',
params: query
})
}
// 查询生产工单详细
export function getProdPlanInfo(objId) {
return request({
url: '/mes/prod/prodPlanInfo/' + objId,
method: 'get'
})
}
// 新增生产工单
export function addProdPlanInfo(data) {
return request({
url: '/mes/prod/prodPlanInfo',
method: 'post',
data: data
})
}
// 修改生产工单
export function updateProdPlanInfo(data) {
return request({
url: '/mes/prod/prodPlanInfo',
method: 'put',
data: data
})
}
// 删除生产工单
export function delProdPlanInfo(objId) {
return request({
url: '/mes/prod/prodPlanInfo/' + objId,
method: 'delete'
})
}
// 订单新增生产工单List
export function orderAddProdPlanInfoList(data) {
return request({
url: '/mes/prod/prodPlanInfo/orderAddProdPlanInfoList',
method: 'post',
data: data
})
}

@ -512,6 +512,9 @@ export default {
}
},
created() {
if (this.$route.params != null){
this.queryParams = this.$route.params
}
this.getList()
},
methods: {

@ -2,97 +2,110 @@
<div>
<el-card>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">工单信息</span></el-divider>
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">ERP订单信息</span>
</el-divider>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="工单号:">{{ form.orderCode }}</el-form-item>
<el-form-item label="订单编号:">{{ form.orderCode }}</el-form-item>
<el-form-item label="成品编码:">{{ form.materialCode }}</el-form-item>
<el-form-item label="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item>
<el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px">
{{ form.planAmount }}/{{ form.dispatchAmount }}/{{ form.completeAmount }}
<el-form-item label="计划开始时间:">{{ parseTime(form.beginDate) }}</el-form-item>
<el-form-item label="选择生产BOM">
<el-select v-model="form.bomId" placeholder="请选择生产BOM">
<el-option
v-for="item in orderBomList"
:key="item.objId"
:label="item.materialAll"
:value="item.objId"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工艺路线:">{{ form.dispatchName }}</el-form-item>
<el-form-item label="成品名称:">{{ form.materialName }}</el-form-item>
<el-form-item label="计划结束时间:">{{ parseTime(form.planEndTime) }}</el-form-item>
<el-form-item label="计划数量(米):" label-width="140px"> {{ form.orderAmount }}</el-form-item>
<el-form-item label="成品名称:" label-width="140px">{{ form.materialName }}</el-form-item>
<el-form-item label="计划结束时间:" label-width="140px">{{ parseTime(form.endDate) }}</el-form-item>
</el-col>
</el-row>
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">派工信息</span></el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan">
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan"
:disabled="single">删除
</el-button>
</el-col>
</el-row>
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">生产工单信息</span>
</el-divider>
<!-- <el-row :gutter="10" class="mb8">-->
<!-- <el-col :span="1.5">-->
<!-- <el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan">-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteMesProductPlan"-->
<!-- :disabled="single"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-table ref="mesProductPlan" :data="mesProductPlanList"
:row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange">
:row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange"
>
<el-table-column align="center" type="selection" width="50"/>
<el-table-column align="center" label="序号" prop="index" width="50" v-if="false"/>
<el-table-column align="center" label="派工单号" prop="dispatchCode" width="290">
<el-table-column align="center" label="工单编号" prop="planCode" width="160">
<template slot-scope="scope">
<el-input v-model="scope.row.dispatchCode" :disabled="true"/>
<el-input v-model="scope.row.planCode" :disabled="true"/>
</template>
</el-table-column>
<el-table-column align="center" label="工序" prop="processName" width="140">
<el-table-column align="center" label="物料编号" prop="materialCode" width="140">
<template slot-scope="scope">
<el-input v-model="scope.row.processName" :disabled="true"/>
<el-input v-model="scope.row.materialCode" :disabled="true"/>
</template>
</el-table-column>
<el-table-column align="center" label="步骤" prop="processOrder">
<el-table-column align="center" label="物料名称" prop="materialName" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.processOrder" :disabled="true"/>
<el-input v-model="scope.row.materialName" :disabled="true"/>
</template>
</el-table-column>
<el-table-column align="center" label="工位" prop="stationName" width="140">
<el-table-column align="center" label="派工数量" prop="planAmount" width="240">
<template slot-scope="scope">
<el-input v-model="scope.row.stationName" :disabled="true"/>
<el-input-number v-model="scope.row.planAmount"/>
</template>
</el-table-column>
<el-table-column align="center" label="派工数量" prop="planAmount" width="100">
<el-table-column align="center" label="计划工位" prop="stationCode" width="180">
<template slot-scope="scope">
<el-input v-model="scope.row.planAmount" :disabled="scope.row.oldRowFlag"/>
<el-select v-model="scope.row.stationCode" placeholder="请选择计划工位">
<el-option
v-for="item in productLineList"
:key="item.productLineCode"
:label="item.productLineName"
:value="item.productLineCode"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" label="派工标准工时" prop="productionTime" width="100">
<el-table-column align="center" label="计划班组" prop="teamCode">
<template slot-scope="scope">
<el-input v-model="scope.row.productionTime" :disabled="scope.row.oldRowFlag"/>
<el-select v-model="scope.row.teamCode" placeholder="请选择班组名称">
<el-option
v-for="item in teamMembersList"
:key="item.teamCode"
:label="item.teamName"
:value="item.teamCode"
/>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230">
<el-table-column align="center" label="计划开始时间" prop="planBeginTime">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planBeginTime" :disabled="scope.row.oldRowFlag" clearable
<el-date-picker v-model="scope.row.planBeginTime" clearable
placeholder="请选择计划开始时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
/>
</template>
</el-table-column>
<el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230">
<el-table-column align="center" label="计划完成时间" prop="planEndTime">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planEndTime" :disabled="scope.row.oldRowFlag" clearable
<el-date-picker v-model="scope.row.planEndTime" clearable
placeholder="请选择计划完成时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="planStatus" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.planStatus" :disabled="true" placeholder="请选择状态">
<el-option
v-for="dict in dict.type.product_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
/>
</template>
</el-table-column>
</el-table>
</el-form>
<el-form label-width="100px">
@ -104,15 +117,18 @@
</el-card>
</div>
</template>
<script>
import { getProdOrderInfo, listProdOrderInfo } from '@/api/mes/prod/prodOrderInfo'
import { getProdOrderInfo } from '@/api/mes/prod/prodOrderInfo'
import { findOrderBomList, generateTickets } from '@/api/mes/prod/prodBomInfo'
import { getBaseProductLineList } from '@/api/mes/base/baseProductLine'
import { getTeamMembers } from '@/api/mes/base/baseTeamMembers'
import { orderAddProdPlanInfoList } from '@/api/mes/prod/prodPlanInfo'
export default {
name: "productPlanEdit",
name: 'productPlanEdit',
dicts: ['product_status'],
data() {
return {
@ -127,15 +143,21 @@ export default {
//
uploadImgUrl: process.env.VUE_APP_BASE_API,
// name
activeName: "columnInfo",
activeName: 'columnInfo',
//
tableHeight: document.documentElement.scrollHeight - 245 + "px",
tableHeight: document.documentElement.scrollHeight - 245 + 'px',
//
tables: [],
//
columns: [],
//
mesProductPlanList: [],
//
productLineList: [],
//
teamMembersList: [],
// BOM
orderBomList: [],
//
info: {},
//
@ -143,124 +165,77 @@ export default {
//
rules: {
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
},
};
{ required: true, message: '物料ID不能为空', trigger: 'blur' }
]
}
}
},
created() {
const objId = this.$route.params && this.$route.params.objId;
console.log(123,objId)
const objId = this.$route.params && this.$route.params.objId
if (objId) {
//
getProdOrderInfo(objId).then(res => {
this.form = res.data;
});
// getProductPlan({objId: objId}).then(res => {
// res.data.forEach(e => {
// this.mesProductPlanList.push(e);
// })
// })
this.form = res.data
// BOM
findOrderBomList({ materialCode: this.form.materialCode, parentId: 0 }).then(res => {
this.orderBomList = res.data
})
})
getBaseProductLineList({ productLineType: 2 }).then(response => {
this.productLineList = response.data
})
getTeamMembers().then(response => {
this.teamMembersList = response.data
})
}
},
watch: {
'form.bomId': function(newVal, oldVal) {
//
if (newVal == null) {
return
}
this.addTicketInfo(newVal)
}
},
methods: {
/** 提交按钮 */
submitForm() {
let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag);
let dataList = this.mesProductPlanList
if (dataList.length === 0) {
this.close();
return;
this.close()
return
}
// ( + <= )
// processIdplanAmountplanAmount
const sumList = dataList.reduce((result, {processId, planAmount}) => {
const numericAmount = parseInt(planAmount, 10);
if (!this.isPositiveInteger(numericAmount)) {
this.$modal.msgError("派工数量须为大于等于0的正整数");
return;
}
result[processId] = (result[processId] || 0) + numericAmount;
return result;
}, {});
const uniqueSum = new Set(Object.values(sumList));
if (uniqueSum.size === 1) {
const finalSum = Array.from(uniqueSum)[0];
let dispatchedAmount = this.form.dispatchAmount + finalSum;
if (dispatchedAmount > this.form.planAmount) {
this.$modal.msgError("每个工序的派工数量之和需小于等于该工单计划数量!");
return;
}
dataList.forEach(e => {
e.dispatchedAmount = dispatchedAmount;
}
)
} else {
this.$modal.msgError("每个工序的派工数量之和需相等!");
return;
}
orderAddProdPlanInfoList(dataList).then(res => {
this.$modal.msgSuccess(res.msg)
this.close()
})
orderAddMesProductPlanList(dataList).then(res => {
this.$modal.msgSuccess(res.msg);
this.close();
});
},
/** 删除按钮操作 */
// handleDeleteMesProductPlan() {
// let productPlan = this.checkedMesProductPlanList[0];
// this.$modal.confirm('"' + productPlan.dispatchCode + '"').then(function () {
// return true;
// }).then(() => {
// if (productPlan.planId === undefined || productPlan.planId === null) {
// //
// const mesProductPlanDetailList = this.mesProductPlanList;
// this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
// return productPlan.dispatchCode !== item.dispatchCode
// });
// } else {
// //
// const delList = this.mesProductPlanList;
// let dispatchSum = 0;
// try {
// const planIds = delList.filter(function (item) {
// return productPlan.dispatchCode === item.dispatchCode
// }).map(item => {
// if (item.planStatus !== '1') {
// throw Error("");
// }
// if (item.processId === productPlan.processId) {
// dispatchSum = dispatchSum + item.planAmount;
// }
// return item.planId;
// });
// dispatchSum = this.form.dispatchAmount - dispatchSum;
// delProductplan(planIds).then(res =>{
// //
// updateProductOrder({
// productOrderId: this.form.productOrderId,
// dispatchAmount: dispatchSum
// })
// getProductOrder(this.form.productOrderId).then(res => {
// this.form = res.data;
// });
// });
// const mesProductPlanDetailList = this.mesProductPlanList;
// this.mesProductPlanList = mesProductPlanDetailList.filter(function (item) {
// return productPlan.dispatchCode !== item.dispatchCode
// });
// this.$modal.msgSuccess("");
// } catch (e) {
// this.$modal.msgError(e);
// }
// }
// }).catch(() => {
// });
// },
//
addTicketInfo(bomId) {
this.mesProductPlanList = []
generateTickets({ ancestors: bomId }).then(res => {
let bomList = res.data
bomList.forEach(e => {
let obj = {}
obj.planCode = e.planCode
obj.orderCode = this.form.orderCode
obj.materialCode = e.materialCode
obj.materialName = e.materialName
obj.planAmount = (e.standardAmount * this.form.orderAmount).toFixed(2)
obj.planBeginTime = this.form.beginDate
obj.planEndTime = this.form.endDate
this.mesProductPlanList.push(obj)
console.log(this.mesProductPlanList)
})
})
},
/** 生产计划明细序号 */
rowMesProductPlanIndex({row, rowIndex}) {
row.index = rowIndex + 1;
rowMesProductPlanIndex({ row, rowIndex }) {
row.index = rowIndex + 1
},
/** 复选框选中数据 */
handleMesProductPlanSelectionChange(selection) {
@ -269,63 +244,65 @@ export default {
},
/** 关闭按钮 */
close() {
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), queryParams: this.$route.query.queryParams}};
this.$tab.closeOpenPage(obj);
const obj = {
path: '/prod/prodOrderInfo',
query: { t: Date.now(), queryParams: this.$route.query.queryParams }
}
this.$tab.closeOpenPage(obj)
},
/** 生产计划添加按钮操作 */
handleAddMesProductPlan() {
let dispatchCode = "";
let dispatchCode = ''
getDispatchCode().then(res => {
dispatchCode = res.msg;
dispatchCode = res.msg
getStationByRouteId(this.form.dispatchId).then(res => {
if (res.data.length === 0) {
this.$modal.msgError("工艺路线未维护工位信息!");
this.$modal.msgError('工艺路线未维护工位信息!')
}
let lastProcessId = null;
let lastProcessId = null
res.data.forEach((e, index) => {
let obj = {};
obj.dispatchCode = dispatchCode;
obj.processId = e.processId;
obj.processName = e.processName;
obj.processOrder = e.processOrder;
obj.stationId = e.stationId;
obj.stationName = e.stationName;
obj.productionTime = 0;
obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime;
obj.planStatus = '1';
let obj = {}
obj.dispatchCode = dispatchCode
obj.processId = e.processId
obj.processName = e.processName
obj.processOrder = e.processOrder
obj.stationId = e.stationId
obj.stationName = e.stationName
obj.productionTime = 0
obj.planBeginTime = this.form.planBeginTime
obj.planEndTime = this.form.planEndTime
obj.planStatus = '1'
// multiStationFlag
if (e.multiStationFlag > 1) {
obj.planAmount = 0;
obj.planAmount = 0
} else {
obj.planAmount = this.form.planAmount - this.form.dispatchAmount;
obj.planAmount = this.form.planAmount - this.form.dispatchAmount
}
obj.materialId = this.form.materialId;
obj.materialBomId = this.form.materialBomId;
obj.productOrderId = this.form.productOrderId;
obj.materialId = this.form.materialId
obj.materialBomId = this.form.materialBomId
obj.productOrderId = this.form.productOrderId
// ID
if (lastProcessId == null) {
obj.lastProcessId = 0;
} else if(lastProcessId === obj.processId){
obj.lastProcessId = this.mesProductPlanList[index - 1].lastProcessId;
obj.lastProcessId = 0
} else if (lastProcessId === obj.processId) {
obj.lastProcessId = this.mesProductPlanList[index - 1].lastProcessId
} else {
obj.lastProcessId = lastProcessId;
obj.lastProcessId = lastProcessId
}
lastProcessId = e.processId;
lastProcessId = e.processId
// false=true=
obj.oldRowFlag = false;
this.mesProductPlanList.push(obj);
obj.oldRowFlag = false
this.mesProductPlanList.push(obj)
})
})
})
},
}
},
mounted() {
}
}
;
</script>

@ -0,0 +1,511 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="订单编号" prop="orderCode">
<el-input
v-model="queryParams.orderCode"
placeholder="请输入订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工单编号" prop="planCode">
<el-input
v-model="queryParams.planCode"
placeholder="请输入工单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料编号" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入物料名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="计划工位" prop="stationCode">
<el-input
v-model="queryParams.stationCode"
placeholder="请输入计划工位"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="设备编号" prop="deviceCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.deviceCode"-->
<!-- placeholder="请输入设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="计划班组" prop="teamCode">
<el-input
v-model="queryParams.teamCode"
placeholder="请输入计划班组"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="实际开始时间">
<el-date-picker
v-model="daterangeBeginTime"
style="width: 340px"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
<!-- <el-form-item label="实际完成时间" prop="endTime">-->
<!-- <el-date-picker clearable-->
<!-- v-model="queryParams.endTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择实际完成时间"-->
<!-- >-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="完成标识" prop="compFlag">
<el-select v-model="queryParams.compFlag" placeholder="请选择完成标识" clearable>
<el-option
v-for="dict in dict.type.finish_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes/prod:prodPlanInfo:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes/prod:prodPlanInfo:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes/prod:prodPlanInfo:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['mes/prod:prodPlanInfo:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="prodPlanInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="objId" v-if="columns[0].visible"/>
<el-table-column label="工单编号" align="center" prop="planCode" v-if="columns[1].visible"/>
<el-table-column label="订单编号" align="center" prop="orderCode" v-if="columns[2].visible"/>
<el-table-column label="物料编号" align="center" prop="materialCode" v-if="columns[3].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[4].visible"/>
<el-table-column label="计划工位" align="center" prop="stationCode" v-if="columns[5].visible"/>
<el-table-column label="设备编号" align="center" prop="deviceCode" v-if="columns[6].visible"/>
<el-table-column label="计划班组" align="center" prop="teamCode" v-if="columns[7].visible"/>
<el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[8].visible"/>
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[9].visible"/>
<el-table-column label="实际开始时间" align="center" prop="beginTime" width="180" v-if="columns[10].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.beginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" prop="endTime" width="180" v-if="columns[11].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="完成标识" align="center" prop="compFlag" v-if="columns[12].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.finish_flag" :value="scope.row.compFlag"/>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createdBy" v-if="columns[13].visible"/>
<el-table-column label="创建时间" align="center" prop="createdTime" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updatedBy" v-if="columns[15].visible"/>
<el-table-column label="更新时间" align="center" prop="updatedTime" width="180" v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes/prod:prodPlanInfo:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes/prod:prodPlanInfo:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改生产工单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="工单编号" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入工单编号"/>
</el-form-item>
<el-form-item label="订单编号" prop="orderCode">
<el-input v-model="form.orderCode" placeholder="请输入订单编号"/>
</el-form-item>
<el-form-item label="物料编号" prop="materialCode">
<el-input v-model="form.materialCode" placeholder="请输入物料编号"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物料名称"/>
</el-form-item>
<el-form-item label="计划工位" prop="stationCode">
<el-input v-model="form.stationCode" placeholder="请输入计划工位"/>
</el-form-item>
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号"/>
</el-form-item>
<el-form-item label="计划班组" prop="teamCode">
<el-input v-model="form.teamCode" placeholder="请输入计划班组"/>
</el-form-item>
<el-form-item label="计划数量" prop="planAmount">
<el-input v-model="form.planAmount" placeholder="请输入计划数量"/>
</el-form-item>
<el-form-item label="完成数量" prop="completeAmount">
<el-input v-model="form.completeAmount" placeholder="请输入完成数量"/>
</el-form-item>
<el-form-item label="实际开始时间" prop="beginTime">
<el-date-picker clearable
v-model="form.beginTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际开始时间"
>
</el-date-picker>
</el-form-item>
<el-form-item label="实际完成时间" prop="endTime">
<el-date-picker clearable
v-model="form.endTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择实际完成时间"
>
</el-date-picker>
</el-form-item>
<el-form-item label="完成标识" prop="compFlag">
<el-radio-group v-model="form.compFlag">
<el-radio
v-for="dict in dict.type.finish_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="创建人" prop="createdBy">
<el-input v-model="form.createdBy" placeholder="请输入创建人"/>
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="form.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间"
>
</el-date-picker>
</el-form-item>
<el-form-item label="更新人" prop="updatedBy">
<el-input v-model="form.updatedBy" placeholder="请输入更新人"/>
</el-form-item>
<el-form-item label="更新时间" prop="updatedTime">
<el-date-picker clearable
v-model="form.updatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间"
>
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listProdPlanInfo,
getProdPlanInfo,
delProdPlanInfo,
addProdPlanInfo,
updateProdPlanInfo
} from '@/api/mes/prod/prodPlanInfo'
export default {
name: 'ProdPlanInfo',
dicts: ['finish_flag'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
prodPlanInfoList: [],
//
title: '',
//
open: false,
//
daterangeBeginTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
planCode: null,
orderCode: null,
materialCode: null,
materialName: null,
stationCode: null,
deviceCode: null,
teamCode: null,
planAmount: null,
completeAmount: null,
beginTime: null,
endTime: null,
compFlag: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null
},
//
form: {},
//
rules: {
objId: [
{ required: true, message: '主键标识不能为空', trigger: 'blur' }
],
planCode: [
{ required: true, message: '工单编号不能为空', trigger: 'blur' }
]
},
columns: [
{ key: 0, label: `主键标识`, visible: true },
{ key: 1, label: `工单编号`, visible: true },
{ key: 2, label: `订单编号`, visible: true },
{ key: 3, label: `物料编号`, visible: true },
{ key: 4, label: `物料名称`, visible: true },
{ key: 5, label: `计划工位`, visible: true },
{ key: 6, label: `设备编号`, visible: true },
{ key: 7, label: `计划班组`, visible: true },
{ key: 8, label: `计划数量`, visible: true },
{ key: 9, label: `完成数量`, visible: true },
{ key: 10, label: `实际开始时间`, visible: true },
{ key: 11, label: `实际完成时间`, visible: true },
{ key: 12, label: `完成标识`, visible: true },
{ key: 13, label: `创建人`, visible: true },
{ key: 14, label: `创建时间`, visible: true },
{ key: 15, label: `更新人`, visible: true },
{ key: 16, label: `更新时间`, visible: true }
]
}
},
created() {
this.getList()
},
methods: {
/** 查询生产工单列表 */
getList() {
this.loading = true
this.queryParams.params = {}
if (null != this.daterangeBeginTime && '' != this.daterangeBeginTime) {
this.queryParams.params['beginBeginTime'] = this.daterangeBeginTime[0]
this.queryParams.params['endBeginTime'] = this.daterangeBeginTime[1]
}
listProdPlanInfo(this.queryParams).then(response => {
this.prodPlanInfoList = response.rows
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
objId: null,
planCode: null,
orderCode: null,
materialCode: null,
materialName: null,
stationCode: null,
deviceCode: null,
teamCode: null,
planAmount: null,
completeAmount: null,
beginTime: null,
endTime: null,
compFlag: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeBeginTime = []
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.objId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加生产工单'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const objId = row.objId || this.ids
getProdPlanInfo(objId).then(response => {
this.form = response.data
this.open = true
this.title = '修改生产工单'
})
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateProdPlanInfo(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addProdPlanInfo(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const objIds = row.objId || this.ids
this.$modal.confirm('是否确认删除生产工单编号为"' + objIds + '"的数据项?').then(function() {
return delProdPlanInfo(objIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/prod/prodPlanInfo/export', {
...this.queryParams
}, `prodPlanInfo_${new Date().getTime()}.xlsx`)
}
}
}
</script>
Loading…
Cancel
Save