Commit 6ff8bab7 authored by renjintao's avatar renjintao

智能排产start

parent 0ade4f14
<template>
<div class="parameter">
<div v-if="load" style="width:100px;margin:0 auto;padding-top:260px;">
<Spin size="large"></Spin>
</div>
<div v-show="!load">
<Form ref="form" label-position="top" :model="entity" :rules="rules">
<Row :gutter="24">
<Col span="24" style="height:80px;">
<FormItem :label="l('templateName')" prop="tempName">
<Input v-model="entity.tempName"></Input>
</FormItem>
</Col>
<Col span="24" style="height:60px;">
<FormItem :label="l('templateDesc')">{{entity.tempInfo}}</FormItem>
</Col>
<Col span="24">
<FormItem :label="l('templateList')"></FormItem>
</Col>
</Row>
</Form>
<div>
<div
class="listFather"
v-for="(item,index) in tempDataList"
v-dragging="{ item: item, list: tempDataList, group: 'item'}"
:key="item.name"
title="拖动上下移动"
>
<div>
<Icon type="md-move" />
{{index+1}}.{{item.name}}
</div>
<div
class="listChildren"
v-for="(item1,index1) in item.sons"
v-dragging="{ item: item1, list: item.sons, group: 'item1' }"
:key="index1"
>
<div>
<Icon type="md-move" />
{{index1+1}}.{{item1.name}}
</div>
</div>
</div>
</div>
<Row>
<Col span="24" style="text-align:right;height:60px;line-height:60px">
<Button type="primary" @click="handleSubmit">确定</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</Col>
</Row>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
entity: {
id: null,
tempName: "",
tempInfo: ""
},
tempDataList: [],
tempInfo: "",
listTemp: [],
listTempShort: [],
rules: {
tempName: [{ required: true, message: "必填", trigger: "blur" }]
},
load: true
};
},
props: {
rowId: { type: Number, default: 0 }
},
created() {},
mounted() {
this.$dragging.$on("dragged", ({ value }) => {
if (this.listTemp.length < 1 && value.list.length < 5) {
this.listTemp = this.tempDataList;
this.listTempShort = value.list;
this.listTemp.forEach(dataAdd1 => {
if (dataAdd1.sons && dataAdd1.sons.length > 0) {
dataAdd1.sons = [];
dataAdd1.sons = this.listTempShort;
}
});
} else if (this.listTemp.length > 1 && value.list.length < 5) {
this.listTempShort = value.list;
this.listTemp.forEach(dataAdd => {
if (dataAdd.sons && dataAdd.sons.length > 0) {
dataAdd.sons = [];
dataAdd.sons = this.listTempShort;
}
});
} else {
this.listTempShort = [];
this.listTemp = value.list;
}
this.outInfo(this.listTemp);
});
this.$dragging.$on("dragend", () => {});
setTimeout(() => {
this.loadInfo();
}, 600);
},
methods: {
//加载模板描述信息
loadInfo() {
let tempList = [];
if (this.rowId == 0) {
//新增模板时新增接口方法
Api.addsorttemplateplus().then(r => {
if (r.success) {
tempList = r.result.templateList;
this.tempDataList = tempList;
this.entity.id = r.result.id;
this.entity.tempName = "";
//this.entity.tempName = r.result.templateName;
this.outInfo(tempList);
}
});
} else {
//修改模板接口方法
let parms = {
id: this.rowId
};
Api.getsorttemplate(parms).then(r => {
if (r.success) {
tempList = r.result.templateList;
this.tempDataList = tempList;
this.entity.id = this.rowId;
this.entity.tempName = r.result.templateName;
this.outInfo(tempList);
}
});
}
},
//返回模板描述信息
outInfo(list) {
this.tempInfo = "";
list.forEach(data => {
if (data.sons && data.sons.length > 0) {
let dataInfo = "";
data.sons.forEach(dataChild => {
dataInfo += dataChild.name + "-->";
});
dataInfo = dataInfo.substring(0, dataInfo.length - 3);
this.tempInfo +=
data.name.substr(0, data.name.length - 2) +
"【" +
dataInfo +
"】-->";
} else {
this.tempInfo += data.name.substr(0, data.name.length - 2) + "-->";
}
});
this.load = false;
this.tempInfo = this.tempInfo.substring(0, this.tempInfo.length - 3);
this.entity.tempInfo = this.tempInfo;
},
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
let params = {
id: this.entity.id,
templateName: this.entity.tempName,
templateDesc: this.entity.tempInfo,
templateList:
this.listTemp.length < 1 ? this.tempDataList : this.listTemp
};
let tempArray = params.templateList;
params.templateList = [];
tempArray.forEach((dataArray, index,tempArray) => {
dataArray.seq = index + 1;
if (dataArray.sons && dataArray.sons.length > 1) {
let tempSons=[]
tempSons=dataArray.sons
tempSons.forEach((dataArraySons, index1,tempSons) => {
dataArraySons.seq = index1 + 1;
});
}
params.templateList.push(dataArray);
});
Api.savesorttemplate(params)
.then(res => {
if (res.success && res.result) {
if (this.rowId == 0) {
this.$Message.success("新增成功");
} else {
this.$Message.success("编辑成功");
}
let paramsData = {
id: this.entity.id,
name: this.entity.tempName,
desc: this.entity.tempInfo
};
this.$emit("on-ok", paramsData);
this.$emit("on-close");
} else {
this.$Message.error("新增失败");
this.$emit("on-close");
}
})
.catch(e => {
this.$Message.error("数据异常!");
});
}
});
},
handleClose() {
if (this.rowId == 0) {
let params = {
id: this.entity.id
};
Api.removesorttemplate(params).then(r => {
if (r.success) {
} else {
this.$Message.error("删除失败");
}
});
}
this.$emit("on-close");
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
},
computed: {},
watch: {
rowId(v) {
if (v != 0) {
this.entity.id = v;
}
}
}
};
</script>
<style lang="less">
.parameter {
.ivu-form-item {
margin-bottom: 4px;
vertical-align: top;
zoom: 1;
}
.ivu-form .ivu-form-item-label {
font-weight: bold;
padding: 0;
}
.listFather {
padding: 5px 5px 0px 5px;
border-bottom: #ccc solid 1px;
line-height: 30px;
cursor: move;
}
.listFather:hover {
background: #e9f2fd;
}
.listChildren {
padding: 5px 5px 5px 20px;
border-bottom: #ccc dotted 1px;
line-height: 25px;
cursor: move;
}
.listChildren:hover {
background: #d3e6fb;
}
}
</style>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index: `${resourceUrl}mesparttaskplansimulate/paged`,
paged(params) {
return Api.post(`${resourceUrl}/mesparttaskplansimulate/paged`, params);
},
get(params) {
return Api.get(`${resourceUrl}/mesparttaskplansimulate/get`, params);
},
create(params) {
return Api.post(`${resourceUrl}/mesparttaskplansimulate/create`, params);
},
update(params) {
return Api.post(`${resourceUrl}/mesparttaskplansimulate/update`, params);
},
//删除:
delete(params) {
return Api.delete(`${resourceUrl}/mesparttaskplansimulate/delete`, {
params: params
});
},
//获取排产池数据列表
getall() {
return Api.get(`${apsUrl}/Mes_part_task_plan_simulate/getall`);
},
//点开排产池列表查看对应的工序
getbyorderid(params) {
return Api.get(`${apsUrl}/mes_op_task_plan_simulate/getbyorderid`, params);
},
//订单优先级
orderpriority(params) {
return Api.post(`${apsUrl}/apspoolappservices/orderpriority`, params);
},
//删除工序
removeoptasksimluate(params) {
return Api.post(`${apsUrl}/apspoolappservices/removeoptasksimluate`, params);
},
//恢复工艺
recoveryoptasksimluate(params) {
return Api.post(`${apsUrl}/apspoolappservices/recoveryoptasksimluate`, params);
},
//移出排产池前判断
beforeshiftoutapspool(params) {
return Api.post(`${apsUrl}/apspoolappservices/beforeshiftoutapspool`, params);
},
//移出排产池
shiftoutapspool(params) {
return Api.post(`${apsUrl}/apspoolappservices/shiftoutapspool`, params);
},
//排产计算
apsprepareandcalc(params) {
return Api.post(`${apsUrl}/apspoolappservices/apsprepareandcalc`, params);
},
//排产方案下发
processschemedispatch(params) {
return Api.post(`${apsUrl}/apspoolappservices/processschemedispatch`, params);
},
//APS排产前数据合法性校验
apsdatachecked(params) {
return Api.post(`${apsUrl}/apspoolappservices/apsdatachecked`, params);
},
//获取连班策略
getallcal(params) {
return Api.get(`${apsUrl}/mes_daily_work_sched/getallcal`, params);
},
//工序参数调整
apsschedulupdateparameter(params) {
return Api.post(`${apsUrl}/ser/apsschedulupdateparameter`, params);
},
//获取参数级别和转序等的关系
apsGetall(params) {
return Api.get(`${apsUrl}/apsparaconfig/getall`, params);
},
//获取所在班组的设备或根据设备类型过滤
getequiplist(params) {
return Api.get(`${apsUrl}/mes_equip_info/getequiplist`, params);
},
//获取当前登录人所在车间下的所有部门
userdepartmentsofworkshop(params) {
return Api.get(`${systemUrl}/user/userdepartmentsofworkshop`, params);
},
//工时修改
updatesetuptimeandfirstequip(params) {
return Api.post(`${apsUrl}/mes_op_task_plan_simulate/updatesetuptimeandfirstequip`, params);
},
//工时同步到原始工艺
apsupdate(params) {
return Api.post(`${designUrl}/routingdetail/apsupdate `, params);
},
//排序模板相关start-----
//获取排序规则下拉列表
getdropsortlist() {
return Api.get(`${apsUrl}/apspoolappservices/getdropsortlist`);
},
//点击新增初始化数据
addsorttemplateplus() {
return Api.post(`${apsUrl}/apspoolappservices/addsorttemplateplus`);
},
//保存模板
savesorttemplate(params) {
return Api.post(`${apsUrl}/apspoolappservices/savesorttemplate`, params);
},
//使用排产规则
usesorttemplate(params) {
return Api.post(`${apsUrl}/apspoolappservices/usesorttemplate `, params);
},
//删除排产模板
removesorttemplate(params) {
return Api.post(`${apsUrl}/apspoolappservices/removesorttemplate `, params);
},
//获取单个模板信息
getsorttemplate(params) {
return Api.get(`${apsUrl}/apspoolappservices/getsorttemplate`, params);
},
//排序模板相关end-----
//修改外协工期相关start-----
//得到外协任务列表
getoutsidetimelist() {
return Api.get(`${apsUrl}/apspoolappservices/getoutsidetimelist`);
},
//保存外协任务工期
saveoutsidetime(params) {
return Api.post(`${apsUrl}/apspoolappservices/saveoutsidetime `, params)
},
//保存插单任务
saveinsertorder(params) {
return Api.post(`${apsUrl}/apspoolappservices/saveinsertorder `, params)
},
//取消插单任务
cancelinsertorder(params) {
return Api.post(`${apsUrl}/apspoolappservices/cancelinsertorder `, params)
},
//修改外协工期相关end-----
}
<template>
<div>
<h3 class="tc" v-if="data.res">
<Icon type="md-checkmark-circle" size="32" color="green"/>
数据检查通过
</h3>
<h3 class="tc" v-else>
<Icon type="md-close-circle" size="32" color="red"/>
数据检查失败
</h3>
<div>
<Tabs>
<TabPane v-for="(item,key,index) in list" :key="key" :label="key" :name="key">
<Table :columns="init(item)" :data="item" height="500" border></Table>
</TabPane>
</Tabs>
</div>
</div>
</template>
<script>
export default {
name: "",
data() {
return {
datas:{},
};
},
props:{
data:Object,
default:()=>{
return {
res:true,
datas:'{}',
}
}
},
computed:{
list(){
var data={};
if(this.data.datas!=''){
var item=JSON.parse(this.data.datas);
for(var key in item)
{
if(item[key]&& item[key].length>0){
data[key]= item[key];
}
}
}
return data;
}
},
methods:{
init(items){
var cols=[];
if(items.length>0){
for(var key in items[0]){
let col={
key:key,
title:key
}
cols.push(col);
}
}
return cols;
}
}
};
</script>
<style lang="less" >
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col :span="12">
<FormItem :label="l('tASKSEQ')" prop="tASKSEQ">{{this.entity.task_seq}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('tASKNAME')" prop="tASKNAME">{{this.entity.task_name}}</FormItem>
</Col>
<Col :span="12">
<FormItem label="生产设备">
<EquipSelect v-model="entity.eQUIPID"></EquipSelect>
</FormItem>
</Col>
<Col :span="12" v-model="entity.rUNTIME">
<FormItem :label="l('rUNTIME')" prop="rUNTIME">
<InputTime v-model="entity.run_time" ></InputTime>
</FormItem>
</Col>
<Col :span="12">
<FormItem label=" ">
<Checkbox v-model="single">是否同步到原始工艺</Checkbox>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "../api";
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {},
orderCatList: [],
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
},
single: false
};
},
props: {
row: {
type: Object,
default: () => {
return null;
}
}
},
methods: {
load(v) {
this.entity = v;
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
let parmsUp = {
run_time: this.entity.run_time,
first_equip: this.entity.eQUIPID,
id: this.entity.id
};
Api.updatesetuptimeandfirstequip(parmsUp)
.then(res => {
if (res.success) {
if (!this.single) {
this.$Message.success("保存成功");
this.$emit("on-option-ok");
} else {
let parms = {
id: this.entity.routing_detail_id, //工序ID
name: this.entity.task_name, //工序名
task_seq: this.entity.task_seq, //工序号
resource_id: this.entity.eQUIPID, //设备id
runtime: this.entity.run_time, //单件工时
department_id: 0 //班组ID
};
Api.apsupdate(parms)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-option-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "mes_op_task_execute" + "." + key;
return this.$t(key);
}
},
watch: {
row(v) {
if (v != {}) {
//alert(JSON.stringify(v))
this.entity = v;
}
}
}
};
</script>
This diff is collapsed.
<template>
<div>
<Row>
<Col span="24">
<DataGrid
:columns="columnsDuration"
ref="gridDuration"
:data="data"
:high="false"
:page="false"
:batch="false"
:easy="false"
:set="false"
:height="400"
:tool="false"
></DataGrid>
</Col>
</Row>
<Modal
v-model="setTimeModal"
title="修改外协时间"
width="680"
footer-hide
@on-cancel="cancel"
>
<EditDuration :rowData="row" ref="editDurationRef" @on-close="cancel" @on-ok="editInfo"></EditDuration>
</Modal>
</div>
</template>
<script>
import Api from "./api";
import EditDuration from "./editDuration";
export default {
components: {
EditDuration
},
data() {
return {
editDuration: null,
tempModal: false,
setTimeModal:false,
columnsDuration: [
{
key: "projectNo",
title: this.l("projectNo"),
align: "left"
},
{
key: "batchNum",
title: this.l("batchNum"),
align: "left",
width: 100
},
{
key: "drawingNum",
title: this.l("drawingNum"),
align: "left",
width: 150
},
{
key: "productName",
title: this.l("productName"),
align: "left",
width: 150
},
{
key: "taskSeq",
title: this.l("taskSeq"),
align: "left",
width: 80
},
{
key: "taskName",
title: this.l("taskName"),
align: "left",
width: 120
},
{
key: "outSideTime",
title: this.l("outSideTime"),
align: "right",
width: 100
},
{
title: " ",
key: "action",
width: 80,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
props: {
icon: "md-create",
type: "icon",
title: "修改外协工期",
oprate: "edit"
},
on: { click: () => this.edit(params.row) }
})
]);
}
}
],
data: [],
row: {}
};
},
created() {},
mounted() {
this.loadDuration();
},
methods: {
loadDuration() {
this.data = [];
Api.getoutsidetimelist()
.then(r => {
if (r.success) {
this.data = r.result;
} else {
this.$Message.error("加载数据失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
},
cancel() {
this.row = {};
this.setTimeModal = false;
},
edit(rowData) {
this.row = rowData;
this.setTimeModal = true;
},
editInfo(entity) {
let tempData = this.data;
this.data = [];
tempData.forEach(data => {
if (data.taskSeq == entity.taskSeq) {
data.outSideTime = entity.outSideTime;
}
this.data.push(data);
});
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
},
computed: {},
watch: {}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
<template>
<div>
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row>
<Col span="12">
<FormItem :label="l('projectNo')">
<Input v-model="entity.projectNo" disabled></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('productName')">
<Input v-model="entity.productName" disabled></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('outSideTime')" prop="outSideTime">
<InputNumber v-model="entity.outSideTime" style="width:150px;" :min="0"></InputNumber>
</FormItem>
</Col>
</Row>
</Form>
<Row>
<Col span="24" style="text-align:right;height:60px;line-height:60px">
<Button type="primary" @click="handleSubmit">确定</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</Col>
</Row>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
entity: {
},
rules: {
outSideTime: [
{ required: true, message: "必填", type: "number", trigger: "change" }
]
}
};
},
props: {
rowData: {
type: Object,
default: () => {
return null;
}
}
},
created() {},
mounted() {},
methods: {
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
let params = {
items: [
{
partTaskPk: this.entity.partTaskPk,
opTaskPk: this.entity.opTaskPk,
outSideTime: this.entity.outSideTime
}
]
};
Api.saveoutsidetime(params)
.then(res => {
if (res.success && res.result) {
this.$Message.success("修改外协时间成功");
this.$emit("on-ok", this.entity);
} else {
this.$Message.error("修改外协时间失败");
}
this.$emit("on-close");
})
.catch(e => {
this.$Message.error("数据异常!");
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
},
computed: {},
watch: {
rowData(v) {
if (v != {}) {
this.entity = this.$u.clone(v);
}
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<template>
<div>
<Row>
<Col span="24">
<DataGrid
:columns="columnsTemp"
ref="gridTemp"
:data="data"
:high="false"
:page="false"
:batch="false"
:easy="false"
:set="false"
:height="400"
>
<template slot="buttons">
<Button type="primary" @click="addTempModal">新增模板</Button>
</template>
</DataGrid>
</Col>
</Row>
<Modal
v-model="tempModal"
:title="tempTitle"
width="680"
footer-hide
class="tempModal"
@on-cancel="cancelModal"
>
<Component
:is="add"
:rowId="id"
ref="tempRef"
@on-close="cancel"
@on-ok="addData"
style="height:600px"
></Component>
</Modal>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
add: null,
tempModal: false,
columnsTemp: [
{
key: "name",
title: this.l("templateName"),
align: "left",
render: (h, params) => {
return h(
"Tooltip",
{
props: {
content: params.row.name,
placement: "top",
transfer: true,
maxWidth: "800"
}
},
params.row.name
);
}
},
{
key: "desc",
title: this.l("templateDesc"),
align: "left",
width: 650
},
{
title: " ",
key: "action",
width: 100,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
props: {
icon: "md-create",
type: "icon",
title: "修改模板",
oprate: "edit"
},
on: { click: () => this.edit(params.row.id) }
}),
h("op", {
props: {
icon: "ios-trash",
type: "icon",
title: "删除模板",
oprate: "delete",
msg: "确定删除模板?"
},
on: { click: () => this.remove(params.row) }
})
]);
}
}
],
tempTitle: "新建模板",
id: 0
};
},
props: {
data: {
type: Array,
default: () => {
return [];
}
}
},
created() {},
mounted() {},
methods: {
addTempModal() {
if (this.add == null) {
this.tempTitle = "新建模板";
this.tempModal = true;
this.add = () => import("./addTemp");
}
},
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
}
});
},
//删除模板
remove(row) {
let params = {
id: row.id
};
Api.removesorttemplate(params).then(r => {
if (r.success) {
this.$Message.success("删除成功");
this.data.splice(row._index, 1);
} else {
this.$Message.success("删除失败");
}
});
},
handleClose() {
this.$emit("on-close");
},
addData(obj) {
//this.data.splice(0, 0,obj);
if (this.id == 0) {
this.data.push(obj);
} else {
let dataTemp = this.data;
this.data = [];
dataTemp.forEach(rowData => {
if (rowData.id == this.id) {
rowData.name = obj.name;
rowData.desc = obj.desc;
}
this.data.push(rowData);
});
}
},
cancel() {
this.add = null;
this.tempModal = false;
},
cancelModal() {
this.$refs.tempRef.handleClose();
this.tempModal = false;
this.add = null;
},
edit(id) {
if (this.add == null) {
this.id = id;
this.tempTitle = "编辑模板";
this.tempModal = true;
this.add = () => import("./addTemp");
}
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
},
computed: {},
watch: {}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -38,7 +38,7 @@
type="info"
v-if="showAi"
>
<a>智能排产&nbsp;&nbsp;&nbsp;</a>
<a href="javascript:;" @click="goAi">智能排产&nbsp;&nbsp;&nbsp;</a>
</Badge>
<Badge
:count="this.$store.state.countAll"
......@@ -554,6 +554,20 @@ export default {
}
}
});
},
goAi() {
Api.moveintoaps().then(res => {
if (res.success) {
if (res.result.res) {
this.$router.push({
name: "aps-ai"
// params: { customerId: id }
});
} else {
this.$Message.error(res.result.msg);
}
}
});
},
goCemplate() {
this.$router.push({
......
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