Commit d58fef4f authored by 仇晓婷's avatar 仇晓婷

aps排产

parent 4c9c39af
...@@ -1137,6 +1137,8 @@ export default { ...@@ -1137,6 +1137,8 @@ export default {
multipleEquip: "是否多台安排设备", // 否 是 multipleEquip: "是否多台安排设备", // 否 是
multipleEquipIds: "设备id", //用英文逗号分隔 multipleEquipIds: "设备id", //用英文逗号分隔
discrete: '离散值', discrete: '离散值',
routingHeaderCode:'工艺编号',
routingHeaderName:'工艺名称',
}, },
routing_header: { routing_header: {
id: '', id: '',
......
<template> <template>
<div style="padding: 0;" class="excute"> <div style="padding: 0" class="excute">
<DataGrid style="margin-top:2px; margin-bottom: -5px;" :columns="columns" ref="grid" :easy="false" :high="false" :set="false" :border="false" :data="data1" :height="gridHeight" :page="false" :size="size"></DataGrid> <DataGrid
style="margin-top: 2px; margin-bottom: -5px"
:columns="columns"
ref="grid"
:easy="false"
:high="false"
:set="false"
:border="false"
:data="data1"
:height="gridHeight"
:page="false"
:size="size"
></DataGrid>
<Modal v-model="editModal" title="编辑" footer-hide width="1000"> <Modal v-model="editModal" title="编辑" footer-hide width="1000">
<Edit :row="rowData" @on-close="cancel" @on-option-ok="addOk" /> <Edit :row="rowData" @on-close="cancel" @on-option-ok="addOk" />
</Modal> </Modal>
<Modal v-model="insertlModal" :title="insertTItle" @on-ok="insertOk" @on-cancel="cancel"> <Modal
<p>确定进行 {{ insertTItle }} 操作?</p> v-model="insertlModal"
:title="insertTItle"
@on-ok="insertOk"
@on-cancel="cancel"
>
<p>确定进行 {{ insertTItle }} 操作?</p>
</Modal> </Modal>
<Modal v-model="setParsModal" title="工序参数设置" footer-hide width="1000"> <Modal v-model="setParsModal" title="工序参数设置" footer-hide width="1000">
<Add @on-parameter-ok="addOk" @on-close="cancel" :opTaskPk="setParams.opTaskPk" :partTaskPk="setParams.partTaskPk" :taskSeq="setParams.taskSeq" :count="setParams.count" :row="rowData" /> <Add
@on-parameter-ok="addOk"
@on-close="cancel"
:opTaskPk="setParams.opTaskPk"
:partTaskPk="setParams.partTaskPk"
:taskSeq="setParams.taskSeq"
:count="setParams.count"
:row="rowData"
/>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
...@@ -18,534 +43,554 @@ import Api from "../api"; ...@@ -18,534 +43,554 @@ import Api from "../api";
import Edit from "./edit"; import Edit from "./edit";
import Add from "../options"; import Add from "../options";
export default { export default {
name: "list", name: "list",
components: { components: {
Edit, Edit,
Add Add,
},
props: {
rowId: {
type: Number,
}, },
props: { },
rowId: { data() {
type: Number return {
action: Api.index,
easySearch: {
keys: {
op: "task_seq",
value: null,
},
},
setParsModal: false,
editModal: false,
detailModal: false,
insertlModal: false,
rowIndex: null,
curId: 0,
gridHeight: 150,
size: "small",
columns: [
{
title: " ",
width: 130,
},
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
high: true,
width: 60,
render: (h, params) => {
return h(
"Tooltip",
{
props: {
content:
params.row.insert_flag == 1 ? "取消插单" : "进行插单",
placement: "top",
},
class: "ico",
},
[
h("Icon", {
attrs: {
type:
params.row.insert_flag == 1
? "ios-flag"
: "ios-flag-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa",
},
on: {
click: () =>
this.changeFlag(params.row.op_task_pk, params.index),
},
}),
]
);
},
},
{
key: "task_seq",
title: this.l("task_seq"),
align: "left",
easy: true,
high: true,
},
{
key: "op_task_pk",
title: this.l("op_task_pk"),
align: "left",
high: true,
hide: true,
},
{
key: "task_name",
title: this.l("task_name"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "taskseq_des",
title: this.l("task_name"),
align: "left",
easy: true,
high: true,
},
{
key: "part_task_pk",
title: this.l("part_task_pk"),
align: "left",
high: true,
hide: true,
},
{
key: "routingHeaderCode",
title: this.l("routingHeaderCode"),
align: "left",
easy: true,
high: true,
},
{
key: "routingHeaderName",
title: this.l("routingHeaderName"),
align: "left",
easy: true,
high: true,
},
{
key: "put_into_qty",
title: this.l("put_into_qty"),
align: "left",
high: true,
hide: true,
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
width: 140,
hide: true,
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
width: 140,
hide: true,
},
{
key: "firsT_EQUIP_CODE",
title: this.l("first_equip"),
align: "left",
// render: (h, params) => { //test:PCZYBZBH_20200804_1 params.row.firsT_EQUIP_CODE
// return h("span", {}, this.getResourceName(params.row.firsT_EQUIP_CODE))
// }
},
{
key: "setup_time",
title: this.l("setup_time"),
align: "right",
high: true,
type: "outputTime",
},
{
key: "run_time",
title: this.l("run_time"),
align: "right",
high: true,
type: "outputTime",
},
{
key: "outside_time",
title: this.l("outside_time"),
align: "right",
high: true,
type: "outputTime",
},
{
key: "transport_time",
title: this.l("transport_time"),
align: "right",
high: true,
hide: true,
type: "outputTime",
},
{
key: "check_time",
title: this.l("check_time"),
align: "right",
high: true,
hide: true,
type: "outputTime",
},
{
key: "efficiency_value",
title: this.l("efficiency_value"),
align: "right",
high: true,
},
{
key: "machine_rule",
title: this.l("machine_rule"),
align: "center",
easy: true,
high: true,
width: 140,
},
{
key: "singleout",
title: this.l("singleout"),
align: "left",
high: true,
hide: true,
},
{
key: "equip_type",
title: this.l("equip_type"),
align: "left",
easy: true,
high: true,
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "cal_id",
title: this.l("cal_id"),
align: "left",
easy: true,
high: true,
},
{
key: "plan_method",
title: this.l("plan_method"),
align: "left",
easy: true,
high: true,
},
{
key: "over_time",
title: this.l("over_time"),
align: "left",
easy: true,
high: true,
},
{
key: "isdiscrete",
title: this.l("isdiscrete"),
align: "center",
easy: true,
high: true,
},
{
key: "discrete_value",
title: this.l("discrete_value"),
align: "right",
high: true,
},
{
key: "multi_machine",
title: this.l("multi_machine"),
align: "center",
easy: true,
high: true,
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "workshopcode",
title: this.l("workshopcode"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "routing_detail_id",
title: this.l("routing_detail_id"),
align: "left",
high: true,
hide: true,
},
{
key: "routing_header_id",
title: this.l("routing_header_id"),
align: "left",
high: true,
hide: true,
},
{
key: "comb_param",
title: this.l("comb_param"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "rule_qty",
title: this.l("rule_qty"),
align: "left",
high: true,
hide: true,
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h(
"div",
{
class: "action",
},
[
h("op", {
attrs: {
icon: "md-options",
type: "icon",
oprate: "detail",
title: "工序参数设置",
},
on: {
click: () => this.openParms(params.row),
},
}),
h("op", {
attrs: {
icon: "md-create",
type: "icon",
title: "編輯工序",
oprate: "edit",
},
on: {
click: () => this.edit(params.row),
},
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "删除工序",
oprate: "delete",
msg: "确认要刪除工序吗?",
},
on: {
click: () => this.remove(params.row, params.index),
},
}),
]
);
},
},
],
data1: [],
insertTItle: "插单",
selectRoutingDetail: {}, //需那种工序
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0, //生产计划数量
},
//设置参数结束
rowData: {}, //编辑时传入行数据
resources: [],
types: [],
};
},
mounted() {
this.loadData(this.rowId);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.types = this.$store.getters.dictionaryByKey("aps.resource.type");
this.getResource();
},
methods: {
//根据点击副组件传过来id进行加载数据
loadData(expendId) {
let params = {
id: expendId,
};
Api.getbyorderid(params).then((res) => {
if (res.success) {
this.gridHeight = 50;
this.gridHeight = (res.result.length + 1) * 47;
this.data1 = res.result;
} }
});
}, },
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "task_seq",
value: null
}
},
setParsModal: false,
editModal: false,
detailModal: false,
insertlModal: false,
rowIndex: null,
curId: 0,
gridHeight: 150,
size: "small",
columns: [{
title: " ",
width: 130
},
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
high: true,
width: 60,
render: (h, params) => {
return h(
"Tooltip", {
props: {
content: params.row.insert_flag == 1 ? "取消插单" : "进行插单",
placement: "top"
},
class: "ico"
},
[
h("Icon", {
attrs: {
type: params.row.insert_flag == 1 ?
"ios-flag" : "ios-flag-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () =>
this.changeFlag(params.row.op_task_pk, params.index)
}
})
]
);
}
},
{
key: "task_seq",
title: this.l("task_seq"),
align: "left",
easy: true,
high: true
},
{
key: "op_task_pk",
title: this.l("op_task_pk"),
align: "left",
high: true,
hide: true
},
{
key: "task_name",
title: this.l("task_name"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "taskseq_des",
title: this.l("task_name"),
align: "left",
easy: true,
high: true
},
{
key: "part_task_pk",
title: this.l("part_task_pk"),
align: "left",
high: true,
hide: true
},
{
key: "put_into_qty",
title: this.l("put_into_qty"),
align: "left",
high: true,
hide: true
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
width: 140,
hide: true
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
width: 140,
hide: true
},
{
key: "firsT_EQUIP_CODE",
title: this.l("first_equip"),
align: "left",
// render: (h, params) => { //test:PCZYBZBH_20200804_1 params.row.firsT_EQUIP_CODE
// return h("span", {}, this.getResourceName(params.row.firsT_EQUIP_CODE))
// }
},
{
key: "setup_time",
title: this.l("setup_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "run_time",
title: this.l("run_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "outside_time",
title: this.l("outside_time"),
align: "right",
high: true,
type: "outputTime"
},
{
key: "transport_time",
title: this.l("transport_time"),
align: "right",
high: true,
hide: true,
type: "outputTime"
},
{
key: "check_time",
title: this.l("check_time"),
align: "right",
high: true,
hide: true,
type: "outputTime"
},
{
key: "efficiency_value",
title: this.l("efficiency_value"),
align: "right",
high: true
},
{
key: "machine_rule",
title: this.l("machine_rule"),
align: "center",
easy: true,
high: true,
width: 140
},
{
key: "singleout",
title: this.l("singleout"),
align: "left",
high: true,
hide: true
},
{
key: "equip_type",
title: this.l("equip_type"),
align: "left",
easy: true,
high: true
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "cal_id",
title: this.l("cal_id"),
align: "left",
easy: true,
high: true
},
{
key: "plan_method",
title: this.l("plan_method"),
align: "left",
easy: true,
high: true
},
{
key: "over_time",
title: this.l("over_time"),
align: "left",
easy: true,
high: true
},
{
key: "isdiscrete",
title: this.l("isdiscrete"),
align: "center",
easy: true,
high: true
},
{
key: "discrete_value",
title: this.l("discrete_value"),
align: "right",
high: true
},
{
key: "multi_machine",
title: this.l("multi_machine"),
align: "center",
easy: true,
high: true
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
},
{ //插单事件start----
key: "workshopcode", changeFlag(id, index) {
title: this.l("workshopcode"), this.rowIndex = index;
align: "left", if (this.data1[this.rowIndex].insert_flag == 1) {
easy: true, this.insertTItle = "取消插单";
high: true, } else {
hide: true this.insertTItle = "插单";
}, }
{ this.insertlModal = true;
key: "routing_detail_id",
title: this.l("routing_detail_id"),
align: "left",
high: true,
hide: true
},
{
key: "routing_header_id",
title: this.l("routing_header_id"),
align: "left",
high: true,
hide: true
},
{
key: "comb_param",
title: this.l("comb_param"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "rule_qty",
title: this.l("rule_qty"),
align: "left",
high: true,
hide: true
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h("op", {
attrs: {
icon: "md-options",
type: "icon",
oprate: "detail",
title: "工序参数设置"
},
on: {
click: () => this.openParms(params.row)
}
}),
h("op", {
attrs: {
icon: "md-create",
type: "icon",
title: "編輯工序",
oprate: "edit"
},
on: {
click: () => this.edit(params.row)
}
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "删除工序",
oprate: "delete",
msg: "确认要刪除工序吗?"
},
on: {
click: () => this.remove(params.row, params.index)
}
})
]);
}
}
],
data1: [],
insertTItle: "插单",
selectRoutingDetail: {}, //需那种工序
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0 //生产计划数量
},
//设置参数结束
rowData: {}, //编辑时传入行数据
resources: [],
types: [],
};
}, },
mounted() { insertOk() {
this.loadData(this.rowId); //this.loadData(this.row)
}, if (this.data1[this.rowIndex].insert_flag == 1) {
async fetch({ //根据插单数据状态进行插单或取消插单操作
store, let params1 = {
params partTaskPks: [],
}) { opTaskPks: [this.data1[this.rowIndex].op_task_pk],
await store.dispatch("loadDictionary"); // 加载数据字典 };
}, Api.cancelinsertorder(params1)
created() { .then((res) => {
this.types = this.$store.getters.dictionaryByKey("aps.resource.type"); if (res.success) {
this.getResource(); this.$Message.success("取消插单成功!");
}, this.data1[this.rowIndex].insert_flag = 0;
methods: {
//根据点击副组件传过来id进行加载数据
loadData(expendId) {
let params = {
id: expendId
};
Api.getbyorderid(params).then(res => {
if (res.success) {
this.gridHeight = 50;
this.gridHeight = (res.result.length + 1) * 47;
this.data1 = res.result;
}
});
},
//插单事件start----
changeFlag(id, index) {
this.rowIndex = index;
if (this.data1[this.rowIndex].insert_flag == 1) {
this.insertTItle = "取消插单";
} else { } else {
this.insertTItle = "插单"; this.$Message.error("取消插单失败!");
} }
this.insertlModal = true; })
}, .catch((err) => {
insertOk() { this.$Message.error("数据异常!");
//this.loadData(this.row) });
if (this.data1[this.rowIndex].insert_flag == 1) { } else {
//根据插单数据状态进行插单或取消插单操作 let params = {
let params1 = { partTaskPks: [],
partTaskPks: [], opTaskPks: [this.data1[this.rowIndex].op_task_pk],
opTaskPks: [this.data1[this.rowIndex].op_task_pk] };
}; Api.saveinsertorder(params)
Api.cancelinsertorder(params1) .then((res) => {
.then(res => { if (res.success) {
if (res.success) { this.$Message.success("插单成功!");
this.$Message.success("取消插单成功!"); this.data1[this.rowIndex].insert_flag = 1;
this.data1[this.rowIndex].insert_flag = 0;
} else {
this.$Message.error("取消插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else { } else {
let params = { this.$Message.error("插单失败!");
partTaskPks: [],
opTaskPks: [this.data1[this.rowIndex].op_task_pk]
};
Api.saveinsertorder(params)
.then(res => {
if (res.success) {
this.$Message.success("插单成功!");
this.data1[this.rowIndex].insert_flag = 1;
} else {
this.$Message.error("插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} }
this.setParsModal = false; })
this.detailModal = false; .catch((err) => {
this.editModal = false; this.$Message.error("数据异常!");
this.insertlModal = false; });
}, }
//插单事件end---- this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.insertlModal = false;
},
//插单事件end----
//单个工序进行参设置start---- //单个工序进行参设置start----
openParms(row) { openParms(row) {
this.setParams = { this.setParams = {
opTaskPk: row.op_task_pk, opTaskPk: row.op_task_pk,
partTaskPk: row.part_task_pk, partTaskPk: row.part_task_pk,
taskSeq: row.task_seq, taskSeq: row.task_seq,
count: row.put_into_qty count: row.put_into_qty,
}; };
this.rowData = row; this.rowData = row;
this.setParsModal = true; this.setParsModal = true;
}, },
//单个工序进行参数设置end---- //单个工序进行参数设置end----
//编辑工序start---- //编辑工序start----
edit(row) { edit(row) {
this.rowData = row; this.rowData = row;
this.editModal = true; this.editModal = true;
}, },
//编辑工序end---- //编辑工序end----
//删除工序事件start----- //删除工序事件start-----
remove(row, index) { remove(row, index) {
//this.curId = Number(id); //this.curId = Number(id);
this.rowIndex = index; this.rowIndex = index;
this.selectRoutingDetail = row; this.selectRoutingDetail = row;
let params = { let params = {
partPk: this.selectRoutingDetail.part_task_pk, partPk: this.selectRoutingDetail.part_task_pk,
detailIdstr: this.selectRoutingDetail.routing_detail_id detailIdstr: this.selectRoutingDetail.routing_detail_id,
}; };
Api.removeoptasksimluate(params).then(r => { Api.removeoptasksimluate(params).then((r) => {
if (r.success) { if (r.success) {
this.$Message.success("删除成功"); this.$Message.success("删除成功");
this.data1.splice(this.rowIndex, 1); this.data1.splice(this.rowIndex, 1);
}
});
},
addOk() {
this.data1 = [];
this.loadData(this.rowId);
this.setParsModal = false;
this.editModal = false;
},
//删除工序时间end-----
cancel() {
this.curId = 0;
this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.insertlModal = false;
},
//根据firsT_EQUIP_CODE返回对应的首选资源
getResourceName(code) {
let name = ""
let resources = this.$u.clone(this.resources);
if (code && code != '') {
resources.forEach(e => {
if (e.code == code) {
let type = e.type
this.types.forEach(el => {
if (type && type != '' && el.code == e.type) {
name = el.name + "/" + e.title
}
})
}
})
}
return name;
},
//获取首选资源所有的数据
getResource() {
let url = `${systemUrl}/planresource/list`;
let name = ""
this.$api
.post(url, {
pageSize: 2000
})
.then(r => {
this.resources = r.result;
});
},
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
} }
} });
},
addOk() {
this.data1 = [];
this.loadData(this.rowId);
this.setParsModal = false;
this.editModal = false;
},
//删除工序时间end-----
cancel() {
this.curId = 0;
this.setParsModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.insertlModal = false;
},
//根据firsT_EQUIP_CODE返回对应的首选资源
getResourceName(code) {
let name = "";
let resources = this.$u.clone(this.resources);
if (code && code != "") {
resources.forEach((e) => {
if (e.code == code) {
let type = e.type;
this.types.forEach((el) => {
if (type && type != "" && el.code == e.type) {
name = el.name + "/" + e.title;
}
});
}
});
}
return name;
},
//获取首选资源所有的数据
getResource() {
let url = `${systemUrl}/planresource/list`;
let name = "";
this.$api
.post(url, {
pageSize: 2000,
})
.then((r) => {
this.resources = r.result;
});
},
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
},
},
}; };
</script> </script>
<style lang="less"> <style lang="less">
.excute table tr th span, .excute table tr th span,
.excute table tr td { .excute table tr td {
font-size: 10px; font-size: 10px;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment