change - 生产工单排产->自动安排

master
yinq 4 months ago
parent 733bd264f9
commit 36f65f26e7

@ -54,6 +54,16 @@
>关闭 >关闭
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-radio-group v-model="arrangeType">
<el-radio
v-for="dict in arrangeTypeList"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row> </el-row>
@ -86,7 +96,7 @@
<el-table-column label="派工ID" align="center" prop="dispatchId" v-if="columns[11].visible"/> <el-table-column label="派工ID" align="center" prop="dispatchId" v-if="columns[11].visible"/>
<el-table-column label="销售数量" align="center" prop="saleAmount" v-if="columns[12].visible"/> <el-table-column label="销售数量" align="center" prop="saleAmount" v-if="columns[12].visible"/>
<el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[14].visible"/> <el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[14].visible"/>
<el-table-column label="已派工数量" align="center" prop="dispatchAmount" v-if="columns[15].visible"/> <el-table-column label="已派工数量" align="center" prop="dispatchAmount" width="90" v-if="columns[15].visible"/>
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[16].visible"/> <el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[16].visible"/>
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180" v-if="columns[13].visible"> <el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180" v-if="columns[13].visible">
<template slot-scope="scope"> <template slot-scope="scope">
@ -98,6 +108,7 @@
<span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="工期(天)" align="center" prop="duration" width="90" v-if="columns[30].visible"/>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="230" v-if="columns[18].visible"> <el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="230" v-if="columns[18].visible">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.planBeginTime" style="width:200px;" <el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
@ -274,6 +285,7 @@ import {
} from "@/api/mes/productOrder"; } from "@/api/mes/productOrder";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {parseTime} from "@/utils/ruoyi";
export default { export default {
name: "ProductionScheduling", name: "ProductionScheduling",
@ -328,6 +340,11 @@ export default {
}, },
// //
form: {}, form: {},
arrangeType: 1,
arrangeTypeList: [
{label: '手动安排', value: 0},
{label: '自动安排', value: 1}
],
// //
rules: { rules: {
orderCode: [ orderCode: [
@ -371,16 +388,26 @@ export default {
{key: 27, label: `更新人`, visible: false}, {key: 27, label: `更新人`, visible: false},
{key: 28, label: `更新时间`, visible: false}, {key: 28, label: `更新时间`, visible: false},
{key: 29, label: `前置生产工单ID`, visible: false}, {key: 29, label: `前置生产工单ID`, visible: false},
{key: 30, label: `工期(天)`, visible: true},
], ],
}; };
}, },
created() { created() {
const productOrderId = this.$route.params && this.$route.params.productOrderId; const productOrderId = this.$route.params && this.$route.params.productOrderId;
if (productOrderId != null){ if (productOrderId != null) {
this.queryParams.productOrderId = productOrderId; this.queryParams.productOrderId = productOrderId;
} }
this.getList(); this.getList();
}, },
watch: {
productOrderList: {
handler(newVal) {
this.filteredList = this.extractFields(newVal);
},
deep: true,
immediate: true
}
},
methods: { methods: {
/** 查询生产工单;生产工单列表 */ /** 查询生产工单;生产工单列表 */
getList() { getList() {
@ -488,14 +515,33 @@ export default {
extractFields(data) { extractFields(data) {
let result = []; let result = [];
data.forEach(item => { data.forEach(item => {
const { productOrderId, planBeginTime, planEndTime, children } = item; const {productOrderId, planBeginTime, planEndTime, children} = item;
result.push({ productOrderId, planBeginTime, planEndTime }); result.push({productOrderId, planBeginTime, planEndTime});
if (planBeginTime != null && planEndTime != null) {
item.duration = this.calculateDaysDifference(planBeginTime, planEndTime);
}
if (this.arrangeType === 1 && planEndTime != null){
const date = new Date(planEndTime);
date.setDate(date.getDate() + 1);
children.forEach(item => {
item.planBeginTime = parseTime(date);
})
}
if (children) { if (children) {
result = result.concat(this.extractFields(children)); result = result.concat(this.extractFields(children));
} }
}); });
return result; return result;
}, },
//
calculateDaysDifference(date1, date2) {
//
const dateObj1 = new Date(date1);
const dateObj2 = new Date(date2);
//
const timeDifference = dateObj2 - dateObj1;
return timeDifference / (1000 * 60 * 60 * 24);
},
/** 展开/折叠操作 */ /** 展开/折叠操作 */
toggleExpandAll() { toggleExpandAll() {
this.refreshTable = false; this.refreshTable = false;

Loading…
Cancel
Save