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>
<template>
<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>
<Modal v-model="editModal" title="编辑" footer-hide width="800">
<Edit :row="rowData" @on-close="cancel" @on-option-ok="addOk" />
</Modal>
<Modal v-model="insertlModal" :title="insertTItle" @on-ok="insertOk" @on-cancel="cancel">
<p>确定进行 {{ insertTItle }} 操作?</p>
</Modal>
<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"
/>
</Modal>
</div>
</template>
<script>
import Api from "../api";
import Edit from "./edit";
import Add from "../options";
export default {
name: "list",
components: {
Edit,
Add
},
props: {
rowId: { type: Number }
},
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",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true
},
{
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,
hide: 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: {} //编辑时传入行数据
};
},
mounted() {
this.loadData(this.rowId);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
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) * 42;
this.data1 = res.result;
}
});
},
//插单事件start----
changeFlag(id, index) {
this.rowIndex = index;
if (this.data1[this.rowIndex].insert_flag == 1) {
this.insertTItle = "取消插单";
} else {
this.insertTItle = "插单";
}
this.insertlModal = true;
},
insertOk() {
//this.loadData(this.row)
if (this.data1[this.rowIndex].insert_flag == 1) {
//根据插单数据状态进行插单或取消插单操作
let params1 = {
partTaskPks: [],
opTaskPks: [this.data1[this.rowIndex].op_task_pk]
};
Api.cancelinsertorder(params1)
.then(res => {
if (res.success) {
this.$Message.success("取消插单成功!");
this.data1[this.rowIndex].insert_flag = 0;
} else {
this.$Message.error("取消插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else {
let params = {
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;
this.editModal = false;
this.insertlModal = false;
},
//插单事件end----
//单个工序进行参设置start----
openParms(row) {
this.setParams = {
opTaskPk: row.op_task_pk,
partTaskPk: row.part_task_pk,
taskSeq: row.task_seq,
count: row.put_into_qty
};
this.rowData = row;
this.setParsModal = true;
},
//单个工序进行参数设置end----
//编辑工序start----
edit(row) {
this.editModal = true;
this.rowData = row;
},
//编辑工序end----
//删除工序事件start-----
remove(row, index) {
//this.curId = Number(id);
this.rowIndex = index;
this.selectRoutingDetail = row;
let params = {
partPk: this.selectRoutingDetail.part_task_pk,
detailIdstr: this.selectRoutingDetail.routing_detail_id
};
Api.removeoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("删除成功");
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;
},
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
}
}
};
</script>
<style lang="less">
.excute table tr th span,
.excute table tr td {
font-size: 10px;
}
</style>
<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
<template>
<div>
<DataGrid
:columns="columns"
ref="grid"
:draggable="true"
:data="list"
:high="false"
@on-drag-drop="onDragDrop"
:page="false"
@on-selection-change="onSelect"
:batch="true"
:border="true"
:easy="true"
>
<template slot="easySearch">
<div>
<a style="font-weight: bold;" @click="openaddModalTemp">
<Icon type="md-color-palette" size="14" />&nbsp;自定义排序模板
</a>
<a style="font-weight: bold;" @click="openDuration">
<Icon type="md-create" size="14" />&nbsp;修改外协工期
</a>
<Select placeholder="选择历史方案" style="width: 150px;"></Select>
</div>
</template>
<template slot="searchBack"></template>
<template slot="searchForm">
<Search />
</template>
<template slot="buttons">
<DatePicker
type="date"
placeholder="设置基准日期"
style="width: 150px;"
v-model="entity.setTime"
@on-change="getTime"
></DatePicker>
<a style="font-weight: bold;" @click="openAddModel(1)">
<Icon type="ios-options" size="14" />&nbsp;工序参数调整
</a>
<Button
type="primary"
@click="goResults"
style="background:#515A6E;border:solid 1px #515A6E"
>历史方案</Button>
<Button type="primary" @click="openApsModal">智能排产</Button>
</template>
<template slot="batch">
<Button type="primary" class="mr10 ml10" @click="removeOk">移出排产</Button>
</template>
</DataGrid>
<Modal v-model="modalDuration" title="外协任务" footer-hide width="1000">
<Duration ref="durationRef"></Duration>
</Modal>
<Modal v-model="addModal" title="工序参数设置" footer-hide width="1000">
<Add
@on-close="cancel"
@on-parameter-ok="addOk"
:opTaskPk="setParams.opTaskPk"
:partTaskPk="setParams.partTaskPk"
:taskSeq="setParams.taskSeq"
:count="setParams.count"
/>
</Modal>
<Modal v-model="apsModal" title="确定智能排产" @on-ok="apsOk" @on-cancel="cancel">
<p>确定进行智能排产?</p>
</Modal>
<!-- <Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="checkOk" @on-cancel="cancel">
<CheckResult :data="result"></CheckResult>
</Modal> -->
<Modal v-model="resultModal" title="数据检查" width="1500" @on-ok="cancel" @on-cancel="cancel">
<CheckResult :data="result"></CheckResult>
</Modal>
<Modal v-model="apsCheckModal" title="确定智能排产" @on-ok="apsCheckOk" @on-cancel="cancel">
<p>已有排产方案,是否移出排产池?</p>
</Modal>
<Modal v-model="circleModal" title footer-hide :mask-closable="false">
<div slot="close"></div>
<Row>
<Col class="demo-spin-col" span="24">
<Spin fix>
<Icon type="ios-loading" size="36" class="demo-spin-icon-load"></Icon>
<div>智能排产进行中......</div>
</Spin>
</Col>
</Row>
</Modal>
<Modal v-model="insertlModal1" :title="insertTItle1" @on-ok="insertOk1" @on-cancel="cancel">
<p>确定进行 {{ insertTItle1 }} 操作?</p>
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Add from "./options";
import Temp from "./temp";
import Duration from "./duration";
import Expand from "./components/excute";
import CheckResult from "./components/check";
export default {
name: "list",
components: {
Add,
Expand,
Temp,
Duration,
CheckResult
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "notes", value: null }
},
result: {
res: true,
datas: '{}'
},
resultModal: false,
entity: {
setTime: ""
},
addModal: false,
editModal: false,
detailModal: false,
deletelModal: false,
apsModal: false,
modalDuration: false,
insertlModal1: false,
apsCheckModal: false,
tempParams: null,
insertTItle1: "插单",
rowIndex1: null,
list: [],
curId: 0,
columns: [
{
key: "move",
title: " ",
hide: false,
align: "center",
width: 30,
render: (h, params) => {
return h("Icon", {
attrs: {
type: "md-more",
size: 18
},
class: "drag"
});
}
},
{
type: "expand",
width: 50,
render: (h, params) => {
return h(Expand, {
props: {
rowId: params.row.part_task_pk
}
});
}
},
{
key: "selection",
type: "selection",
width: 50,
align: "center"
},
{
key: "id",
title: this.l("id"),
hide: true,
align: "left",
sortable: true,
width: 50
},
{
key: "insert_flag",
title: this.l("insert_flag"),
align: "center",
width: 70,
high: true,
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-water"
: "ios-water-outline",
size: 20,
color: params.row.insert_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () =>
this.changeFlag1(params.row.part_task_pk, params.index)
}
})
]
);
}
},
{
key: "mesCode",
title: this.l("mes_code"),
align: "left",
high: true,
width: 240
},
{
key: "product_name",
title: this.l("product_name"),
align: "left",
high: true
},
{
key: "drawingnum",
title: this.l("drawingnum"),
align: "left",
high: true
},
{
key: "project_no",
title: this.l("project_no"),
align: "left",
high: true
},
{
key: "batchnum",
title: this.l("batchnum"),
align: "left",
high: true
},
{
key: "urgency_level",
title: this.l("urgency_level"),
align: "left",
high: true,
code: "plan.order.urgencyLevel",
width: 100
},
{
key: "priority",
title: this.l("priority"),
align: "left",
high: true,
hide: true,
render: (h, params) => {
return h("span", {}, params.index + 1);
}
},
{
key: "plan_qty",
title: this.l("plan_qty"),
align: "right",
width: 100,
high: true
},
{
key: "spare_qty",
title: this.l("spare_qty"),
align: "right",
width: 100,
high: true,
hide: true
},
{
key: "plan_start",
title: this.l("plan_start"),
align: "center",
high: true,
hide: true,
resizable: true,
width: 150
},
{
key: "plan_finish",
title: this.l("plan_finish"),
align: "center",
high: true,
hide: true,
sortable: true,
resizable: true,
width: 150
},
{
key: "notes",
title: this.l("notes"),
align: "left",
easy: true,
high: true,
hide: true
},
{
key: "demand_start",
title: this.l("demand_start"),
align: "center",
resizable: true,
width: 150,
type: "date"
},
{
key: "demand_finish",
title: this.l("demand_finish"),
align: "center",
high: true,
resizable: true,
width: 150,
type: "date"
},
{
key: "badjustflag",
title: this.l("badjustflag"),
align: "left",
high: true,
hide: true
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
// fixed:"right",
render: (h, params) => {
return h("div", { class: "action" }, [
h("op", {
attrs: {
icon: "md-options",
type: "icon",
title: "工序参数设置",
oprate: "edit"
},
on: { click: () => this.openAddModel(2, params.row) }
}),
h("op", {
attrs: {
icon: "md-refresh",
type: "icon",
title: "恢复工序",
oprate: "edit",
msg: "确认要恢复工序吗?"
},
on: { click: () => this.refresh(params.row.part_task_pk) }
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "移出排产池",
oprate: "delete",
msg: "确认要移出排产吗?"
},
on: { click: () => this.remove(params.row.part_task_pk) }
})
]);
}
}
],
arrPartPkId: [],
//设置参数开始
setParams: {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0 //生产计划数量
},
//设置参数结束
circleModal: false, //进度条
tempStatu: 0 //新建模型时传过来的id值
};
},
mounted() {
this.loadList();
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//排产池加载数据列表
loadList() {
Api.getall().then(res => {
if (res.success) {
this.list = res.result;
}
});
},
addOk() {
this.list = [];
this.loadList();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
},
detail(id) {
this.detailModal = true;
this.curId = id;
},
edit(id) {
this.editModal = true;
this.curId = id;
},
refresh(partPkId) {
//恢复工序
let params = {
id: partPkId
};
Api.recoveryoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("恢复成功");
this.list = [];
this.loadList();
}
});
},
remove(partPkId) {
//移出排产池
this.tempParams = null;
let paramsArry = [];
if (partPkId.constructor == Array) {
paramsArry = partPkId;
} else {
paramsArry.push(partPkId);
}
let params = {
partPks: paramsArry
};
Api.beforeshiftoutapspool(params)
.then(res => {
if (res.success) {
if (res.result) {
this.checkapspool(params);
} else {
this.tempParams = null;
this.tempParams = params;
this.apsCheckModal = true;
}
} else {
this.$Message.error("校验失败");
}
})
.catch(err => {
this.$Message.error("连接错误1");
});
},
apsCheckOk() {
this.checkapspool(this.tempParams);
},
checkapspool(params) {
Api.shiftoutapspool(params)
.then(r => {
if (r.success) {
this.$Message.success("移出排产池操作成功");
this.loadList();
//移出排产后将aps对应的store数量去掉
this.$store.commit(
"setCountAps",
this.$store.state.countAps - params.partPks.length
);
} else {
this.$Message.error("移出排产池操作失败");
}
})
.catch(err => {
this.$Message.error("连接失败2");
});
},
onSelect(a, b) {
//批量选择
let selectRows = a;
this.arrPartPkId = [];
selectRows.forEach(e => {
this.arrPartPkId.push(e.part_task_pk);
});
},
removeOk() {
//批量选择移出排产池
this.remove(this.arrPartPkId);
},
removeCancel() {
this.deletelModal = false;
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
this.apsModal = false;
this.apsCheckModal = false;
this.resultModal = false;
},
onDragDrop(a, b) {
//拖拽排序
//this.list.splice(b, 1, ...this.list.splice(a, 1, this.list[b]));
let tempArray = this.list[a];
this.list.splice(a, 1);
this.list.splice(b, 0, tempArray);
},
openParms(id) {
this.addModal = true;
},
getUserDepart() {
alert("5656565");
// Api.getUserDepart().then(res=>{
// console.log("11111",res)
// return res
// })
},
l(key) {
let vkey = "mes_part_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
},
getTime(value) {
this.entity.getTime = value;
},
openApsModal() {
if (this.entity.setTime != "") {
this.apsModal = true;
} else {
this.$Message.error("请设置基准日期");
}
},
//查看历史方案
goResults() {
this.$router.push({
path: "/ai/results"
// params: { customerId: id }
});
},
//确定智能排产
apsOk() {
this.circleModal = true;
//智能排产前订单优先级功能
let parmsOrderpriority = { alls: [] };
let arryIds = [];
this.list.forEach((e, index) => {
let objIds = {};
objIds.orderId = e.part_task_pk;
objIds.priority = index + 1;
arryIds.push(objIds);
});
parmsOrderpriority.alls = arryIds;
// alert(JSON.stringify(parmsOrderpriority));
Api.orderpriority(parmsOrderpriority)
.then(res => {
if (res.success) {
if (res.result) {
//this.$Message.success("排序成功");
//智能排产前检查
Api.apsdatachecked()
.then(res1 => {
if (res1.success) {
// this.result=res1.result;
// this.resultModal=true;
this.checkOk();
} else {
// this.circleModal = false;
// this.$Message.error("操作失败:数据校验");
this.result=res1.result;
this.resultModal=true;
}
})
.catch(
function(err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
);
} else {
this.circleModal = false;
this.$Message.error("排序失败,请重新智能排产操作");
}
} else {
this.circleModal = false;
this.$Message.error("操作失败:排序");
}
})
.catch(
function(err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
);
},
checkOk() {
//排产计算
let paramsTime = {
setTime: this.entity.setTime
};
Api.apsprepareandcalc(paramsTime)
.then(res2 => {
if (res2.success) {
if (res2.result.res) {
this.$Message.success("排产计算成功");
this.circleModal = false;
this.$router.push({
path: "/ai/results"
// params: { customerId: id }
});
} else {
this.circleModal = false;
this.$Message.error(res2.result.msg);
}
} else {
this.circleModal = false;
this.$Message.error("操作失败:排产计算");
}
})
.catch(
function(err) {
this.circleModal = false;
this.$Message.error("操作失败");
}.bind(this)
);
},
//打开设置参数
openAddModel(type, row) {
if (type == 2) {
this.setParams = {
opTaskPk: 0,
partTaskPk: row.part_task_pk,
taskSeq: "",
count: row.plan_qty
};
} else {
this.setParams = {
opTaskPk: 0,
partTaskPk: 0,
taskSeq: "",
count: 0
};
}
this.addModal = true;
},
//插单start
//插单事件start----
changeFlag1(id, index) {
this.rowIndex1 = index;
if (this.list[this.rowIndex1].insert_flag == 1) {
this.insertTItle1 = "取消插单";
} else {
this.insertTItle1 = "插单";
}
this.insertlModal1 = true;
},
insertOk1() {
if (this.list[this.rowIndex1].insert_flag == 1) {
//根据插单数据状态进行插单或取消插单操作
let params1 = {
partTaskPks: [this.list[this.rowIndex1].part_task_pk],
opTaskPks: []
};
Api.cancelinsertorder(params1)
.then(res => {
if (res.success) {
this.$Message.success("取消插单成功!");
this.list[this.rowIndex1].insert_flag = 0;
} else {
this.$Message.error("取消插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
} else {
let params = {
partTaskPks: [this.list[this.rowIndex1].part_task_pk],
opTaskPks: []
};
Api.saveinsertorder(params)
.then(res => {
if (res.success) {
this.$Message.success("插单成功!");
this.list[this.rowIndex1].insert_flag = 1;
} else {
this.$Message.error("插单失败!");
}
})
.catch(err => {
this.$Message.error("数据异常!");
});
}
this.insertlModal1 = false;
}
//插单end
}
};
</script>
<style lang="less">
.drag {
cursor: move;
}
.demo-spin-icon-load {
animation: ani-demo-spin 1s linear infinite;
}
@keyframes ani-demo-spin {
from {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
to {
transform: rotate(360deg);
}
}
.demo-spin-col {
height: 100px;
position: relative;
border: 0px solid #eee;
}
.vertical-center-modal {
display: flex;
align-items: center;
justify-content: center;
.ivu-modal {
top: 0;
}
}
.tempModal {
.ivu-modal-body {
padding: 16px;
font-size: 14px;
line-height: 1.5;
padding-top: 2px;
padding-bottom: 0px;
}
.ivu-modal-footer {
border-top: none;
padding: 12px 18px 12px 18px;
text-align: right;
}
}
</style>
<template>
<div class="parameter">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row :gutter="20">
<Col span="12">
<div class="filedset" style="height:238px">
<p class="title">多台分配设置</p>
<div class="duo">
<FormItem :label="l('multi_machine')" prop="multiple">
<i-switch v-model="entity.multiple" size="large">
<span slot="open"></span>
<span slot="close"></span>
</i-switch>
</FormItem>
<FormItem label="多台数量" prop="multipleCount">
<InputNumber v-model="entity.multipleCount"></InputNumber>
</FormItem>
<FormItem label="生产设备">
<EquipSelect v-model="entity.multipleEquipPks" multiple></EquipSelect>
</FormItem>
</div>
</div>
<div class="filedset h50">
<p class="title">快速设置</p>
<div class="icon">
<Dropdown trigger="hover">
<a href="javascript:void(0)">
<Icon type="md-git-compare" />
</a>
<DropdownMenu slot="list" style="text-align: center;">
<DropdownItem
v-for="li in items"
:key="li.value"
v-dragging="{ item: li, list: items}"
>
<a href="#">
<Icon type="md-apps" />
</a>
<span>{{li.name}}</span>
</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
<div class="slider">
<Slider
v-model="level"
:step="1"
:min="0"
:max="4"
:marks="levelMarks"
show-stops
@on-change="setParameter"
></Slider>
</div>
</div>
<div class="filedset h50">
<p class="title">应用范围</p>
<div class="slider">
<Slider
v-model="entity.flog"
:step="1"
:min="0"
:max="5"
:marks="marks"
:disabled="partTaskPk==0"
size="large"
></Slider>
<!-- :disabled="partTaskPk==0" -->
</div>
</div>
</Col>
<Col span="12">
<div class="filedset">
<p class="title">参数设置</p>
<FormItem :label="l('plan_method')" prop="planState">
<i-switch v-model="entity.planState" size="large">
<span slot="open">平行</span>
<span slot="close">重叠</span>
</i-switch>
</FormItem>
<FormItem :label="l('calId')" prop="calId">
<Select v-model="entity.calId">
<Option
v-for="(item,index) in listCal"
:key="index"
:value="item.calid"
:label="item.calname"
></Option>
</Select>
</FormItem>
<Divider />
<FormItem :label="l('overTime')" prop="over">
<i-switch v-model="entity.over" size="large">
<span slot="open">加班</span>
<span slot="close">不加班</span>
</i-switch>
</FormItem>
<Row>
<Col :span="12">
<FormItem :label="l('efficiencyValue')" prop="efficiencyValue">
<InputNumber v-model="entity.efficiencyValue" :step="0.01"></InputNumber>
</FormItem>
</Col>
<Col :span="12" v-if="opTaskPk>0">
<FormItem :label="l('run_time')" prop="run_time">
<span v-text="row.run_time"></span>
</FormItem>
</Col>
</Row>
<Divider />
<FormItem :label="l('isDiscrete')" prop="dis">
<i-switch v-model="entity.dis" size="large">
<span slot="open"></span>
<span slot="close"></span>
</i-switch>
</FormItem>
<FormItem :label="l('discrete_percent')" prop="discrete_percent">
<Slider
v-model="entity.discrete_percent"
:step="1"
:min="0"
:max="100"
@on-change="setPercent"
></Slider>
</FormItem>
<FormItem :label="l('discrete')" prop="discrete">
<InputNumber
v-model="entity.discrete"
:disabled="count==0"
:min="1"
:max="count==0?1:count"
@on-change="setDiscrete"
></InputNumber>
<!-- <span>{{count}}</span> -->
</FormItem>
</div>
</Col>
</Row>
<FormItem class="click-btn">
<Button type="primary" @click="handleSubmit">确定</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</div>
</template>
<script>
import Api from "./api";
export default {
data() {
return {
items: [
{ name: "是否多台", value: "multiple" },
{ name: "转序规则", value: "planState" },
{ name: "加班策略", value: "over" },
{ name: "是否离散", value: "dis" }
],
entity: {
partTaskPk: 0,
opTaskPk: 0,
taskSeq: "",
flog: 5, //参数应用范围
calId:"",
planState: false,
planMethod: "重叠", // 平行 重叠
over: false,
overTime: "不加班", //"六日加班", 不加班 加班
efficiencyValue: 11, // 效率系数, 必须大于 0
shopId: -1,
dis: false,
isDiscrete: "否", //是否离散 是否
discrete: 1, //离散数值 必须大于 1
discrete_percent: 0,
multiple: false,
multipleEquip: "否", //"是否多台安排设备", 否 是
multipleCount: 1, //多台数量
multipleEquipPks: [],
multipleEquipIds: "" //"设备id", 用英文逗号分隔
},
// discrete_percent:1,//"离散度"
level: 0, //参数规则ID
levelRules: [],
levelMarks: {
0: "慢",
4: "快"
},
rules: {
// calId: [
// { required: true, message: "必填", type: "number", trigger: "change" }
// ]
},
list: [],
data1: [],
marks: {
0: "工序",
1: "计划",
2: "产品",
3: "项目",
4: "批次",
5: "所有"
},
listCal: [],
visible: false
// rules: {
// businessName: [{ required: true, message: "必填", trigger: "blur" }],
// businessCode: [{ required: true, message: "必填", trigger: "blur" }]
// }
};
},
props: {
opTaskPk: {
//工单ID
type: Number,
default: 0
},
partTaskPk: {
//生产计划ID
type: Number,
default: 0
},
taskSeq: {
//工序编号
type: String,
default: ""
},
count: {
//生产计划数量
type: Number,
default: 0
},
run_time: {
type: Number,
default: 0
},
row: {
type: Object,
default: () => {
return null;
}
}
},
created() {
this.getCal(); //获取连班策略
this.apsGet(); //获取参数级别和转序等的关系
},
mounted() {
this.$dragging.$on("dragged", ({ value }) => {
localStorage.setItem("apsitems", JSON.stringify(value.list));
});
var items = localStorage.getItem("apsitems");
if (items) {
this.items = JSON.parse(items);
}
},
methods: {
getCal() {
Api.getallcal().then(res => {
if (res.success) {
this.listCal = res.result;
}
});
},
apsGet() {
Api.apsGetall().then(res => {
if (res.success) {
this.levelRules = res.result;
// let max = this.levelRules.length - 1;
// let marks = `{0:"慢", ${max}:"快"}`;
// marks = marks.replace(/(\d+):/g,"\"$1\":");
// this.levelMarks = JSON.parse(marks);
this.level = 0;
}
});
},
setParameter(v) {
this.entity.multiple = false;
this.entity.planState = false;
this.entity.over = false;
this.entity.dis = false;
for (var i = 0; i < v; i++) {
this.entity[this.items[i].value] = true;
}
},
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
if (
this.opTaskPk == 0 &&
this.partTaskPk > 0 &&
this.entity.flog < 1
) {
this.$Message.error("计划参数调整参数应用范围不能是工序级的");
this.entity.flog = 1;
return;
}
if (this.entity.multipleEquipPks) {
this.entity.multipleEquipIds = this.entity.multipleEquipPks.join();
}
//
this.entity.planMethod = !this.entity.planState ? "重叠" : "平行";
this.entity.overTime = !this.entity.over ? "不加班" : "加班";
this.entity.isDiscrete = this.entity.dis ? "是" : "否";
this.entity.multipleEquip = this.entity.multiple ? "是" : "否";
Api.apsschedulupdateparameter(this.entity)
.then(res => {
if (res.result.state) {
this.$Message.success(res.result.msg);
this.$emit("on-parameter-ok");
} else {
this.$Message.error(res.result.msg);
}
})
.catch(e => {
this.$Message.error("数据异常!");
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
},
setPercent(v) {
this.entity.discrete = Math.round(
((this.count - 1) * v - this.count) / 100
);
},
setDiscrete(v) {
this.entity.discrete_percent =
(100 * this.count - 100 * this.entity.discrete) / (this.count - 1);
}
},
computed: {
k() {
if (this.count == 0) return 0;
else {
return (
(100 * this.count - 100 * this.entity.discrete) / (this.count - 1)
);
}
}
},
watch: {
partTaskPk(v, n) {
if (v == 0) {
this.entity.flog = 5;
} else if (v > 0 && this.opTaskPk == 0) {
this.entity.flog = 1;
} else {
this.entity.flog = 0;
}
this.entity.partTaskPk = v;
},
opTaskPk(v, n) {
this.entity.opTaskPk = v;
if (v > 0) {
console.log("detail", this.row);
let entity = {
partTaskPk: this.row.part_task_pk,
opTaskPk: this.row.op_task_pk,
taskSeq: this.row.task_seq,
flog: 0, //参数应用范围
calId: this.row.cal_id,
planState: this.row.plan_method == "平行",
planMethod: this.row.plan_method, // 平行 重叠
over: this.row.over_time == "加班",
overTime: this.row.over_time, //"六日加班", 不加班 加班
efficiencyValue: this.row.efficiency_value | 1, // 效率系数, 必须大于 0
shopId: -1,
dis: this.row.isdiscrete == "是",
isDiscrete: this.row.isdiscrete ? "是" : "否", //是否离散 是否
discrete: this.row.discrete_value | 1, //离散数值 必须大于 1
multiple: this.row.multi_machine == "是",
multipleEquip: this.row.multi_machine | "否", //"是否多台安排设备", 否 是
multipleCount: 1, //多台数量
multipleEquipPks: [],
multipleEquipIds: "" //"设备id", 用英文逗号分隔
};
this.entity = entity;
console.warn("detail", this.entity, this.row);
}
this.entity.taskSeq = this.taskSeq;
},
count(v, n) {
this.entity.discrete = 1;
}
}
};
</script>
<style lang="less">
.parameter {
margin: 10px;
.filedset {
position: relative;
border: 1px solid #e0e0e0;
padding: 25px 10px 0 10px;
margin-bottom: 20px;
.title {
display: inline-block;
padding-left: 5px;
background: #fff;
position: absolute;
top: -9px;
left: 25px;
color: #2680eb;
}
.icon {
position: absolute;
right: 10px;
top: 10px;
}
.slider {
padding: 20px 20px;
.ivu-slider-marks-item {
width: 60px;
text-align: center;
// margin-right: -20px;
}
}
}
.h50 {
height: 115px;
}
.click-btn {
text-align: right;
margin-top: 15px;
}
}
</style>
\ No newline at end of file
<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