!21 修改合并

This commit is contained in:
打豆豆 2024-03-21 09:44:05 +00:00 committed by Gitee
commit e5819f167e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
18 changed files with 1829 additions and 595 deletions

View File

@ -205,5 +205,8 @@
<div class="load_title">正在加载系统资源,请耐心等待</div>
</div>
</div>
<script type="text/javascript" src="./static/haikang/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="./static/haikang/jsencrypt.min.js"></script>
<script type="text/javascript" src="./static/haikang/web-control_1.2.5.min.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,3 +42,11 @@ export function delProroute(routeId) {
method: 'delete'
})
}
// 复制
export function copyProRoute(routeId) {
return request({
url: '/mes/pro/proroute/copyProRoute/' + routeId,
method: 'get'
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 KiB

After

Width:  |  Height:  |  Size: 588 KiB

View File

@ -1,12 +1,32 @@
<template>
<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<div
:class="{ 'has-logo': showLogo }"
:style="{
backgroundColor:
settings.sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground,
}"
>
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
<el-scrollbar
:class="settings.sideTheme"
wrap-class="scrollbar-wrapper"
style="height: 80%"
>
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
:text-color="settings.sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
:background-color="
settings.sideTheme === 'theme-dark'
? variables.menuBackground
: variables.menuLightBackground
"
:text-color="
settings.sideTheme === 'theme-dark'
? variables.menuColor
: variables.menuLightColor
"
:unique-opened="true"
:active-text-color="settings.theme"
:collapse-transition="false"
@ -20,6 +40,20 @@
/>
</el-menu>
</el-scrollbar>
<div
style="
height: 10%;
display: flex;
justify-content: center;
align-items: center;
"
@click="stop"
>
<img src="../../../assets/images/emergencyStop.png" style="width: 90px" />
</div>
<div style="height: 10%; width: 100%; font-size: 13px">
紧急制动所有设备全部停止
</div>
</div>
</template>
@ -28,6 +62,7 @@ import { mapGetters, mapState } from "vuex";
import Logo from "./Logo";
import SidebarItem from "./SidebarItem";
import variables from "@/assets/styles/variables.scss";
import axios from "axios";
export default {
components: { SidebarItem, Logo },
@ -51,7 +86,61 @@ export default {
},
isCollapse() {
return !this.sidebar.opened;
},
},
methods: {
stop() {
this.$confirm(
"确定制动后,车间内所有设备将全部紧急停止运行,请谨慎操作! 如确定要进行紧急制动,请点击【确定】按钮!",
"紧急制动确认",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
axios
.get("http://192.168.3.53:8077/manage/task/emergencyStop")
.then((res) => {
if (res.code === 200) {
this.$message({
message: "紧急制动成功",
type: "success",
});
} else {
this.$message({
message: "紧急制动失败",
type: "error",
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消",
});
});
},
},
};
</script>
<style lang="scss">
.el-message-box {
width: 430px !important;
border: 0px solid #ebeef5 !important;
}
.el-message-box__header {
background: #922423 !important;
color: #fff !important;
}
.el-message-box__title {
color: #fdf3f7 !important;
}
.el-message-box__content {
color: #fdf3f7 !important;
background: #cf3533 !important;
}
</style>

View File

@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="类型名称" prop="machineryTypeName">
<el-input
v-model="queryParams.machineryTypeName"
@ -10,7 +17,11 @@
/>
</el-form-item>
<el-form-item label="是否启用" prop="enableFlag">
<el-select v-model="queryParams.enableFlag" placeholder="选择是或否" clearable>
<el-select
v-model="queryParams.enableFlag"
placeholder="选择是或否"
clearable
>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
@ -20,8 +31,16 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
@ -33,14 +52,25 @@
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column label="设备类型编码" prop="machineryTypeCode" />
<el-table-column label="设备类型名称" align="center" prop="machineryTypeName" />
<el-table-column
label="设备类型名称"
align="center"
prop="machineryTypeName"
/>
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
<dict-tag
:options="dict.type.sys_yes_no"
:value="scope.row.enableFlag"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -48,14 +78,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:dv:machinerytype:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['mes:dv:machinerytype:add']"
>新增</el-button>
>新增</el-button
>
<el-button
v-if="scope.row.parentTypeId != 0"
size="mini"
@ -63,7 +95,8 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:dv:machinerytype:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -74,39 +107,70 @@
<el-row>
<el-col :span="24" v-if="form.parentTypeId !== 0">
<el-form-item label="父类型" prop="parentTypeId">
<treeselect v-model="form.parentTypeId" :options="machinerytypeOptions" :normalizer="normalizer" placeholder="请选择父类型" />
<treeselect
v-model="form.parentTypeId"
:options="machinerytypeOptions"
:normalizer="normalizer"
placeholder="请选择父类型"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备类型名称" prop="machineryTypeName">
<el-input v-model="form.machineryTypeName" placeholder="请输入设备类型名称" />
<el-input
v-model="form.machineryTypeName"
placeholder="请输入设备类型名称"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认设备类型" prop="code">
<el-select v-model="form.code" placeholder="请选择默认设备类型">
<el-option
v-for="dict in dict.type.dv_m_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.enableFlag"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.enableFlag" v-else>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
@ -120,15 +184,21 @@
</template>
<script>
import { listMachinerytype, getMachinerytype, delMachinerytype, addMachinerytype, updateMachinerytype } from "@/api/mes/dv/machinerytype";
import {
listMachinerytype,
getMachinerytype,
delMachinerytype,
addMachinerytype,
updateMachinerytype,
} from "@/api/mes/dv/machinerytype";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Machinerytype",
dicts: ['sys_yes_no'],
dicts: ["sys_yes_no", "dv_m_type"],
components: {
Treeselect
Treeselect,
},
data() {
return {
@ -158,15 +228,18 @@ export default {
//
rules: {
parentTypeId: [
{ required: true, message: "父类型不能为空", trigger: "blur" }
{ required: true, message: "父类型不能为空", trigger: "blur" },
],
machineryTypeName: [
{ required: true, message: "设备类型名称不能为空", trigger: "blur" }
{ required: true, message: "设备类型名称不能为空", trigger: "blur" },
],
enableFlag: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
}
code: [
{ required: true, message: "请默认设备类型不能为空", trigger: "blur" },
],
},
};
},
created() {
@ -176,8 +249,12 @@ export default {
/** 查询设备类型列表 */
getList() {
this.loading = true;
listMachinerytype(this.queryParams).then(response => {
this.machinerytypeList = this.handleTree(response.data, "machineryTypeId", "parentTypeId");
listMachinerytype(this.queryParams).then((response) => {
this.machinerytypeList = this.handleTree(
response.data,
"machineryTypeId",
"parentTypeId"
);
this.loading = false;
});
},
@ -189,15 +266,19 @@ export default {
return {
id: node.machineryTypeId,
label: node.machineryTypeName,
children: node.children
children: node.children,
};
},
/** 查询设备类型下拉树结构 */
getTreeselect() {
listMachinerytype().then(response => {
listMachinerytype().then((response) => {
debugger;
this.machinerytypeOptions = [];
const data = this.handleTree(response.data, "machineryTypeId", "parentTypeId")[0];
const data = this.handleTree(
response.data,
"machineryTypeId",
"parentTypeId"
)[0];
this.machinerytypeOptions.push(data);
});
},
@ -213,12 +294,12 @@ export default {
machineryTypeName: null,
parentTypeId: 1,
ancestors: null,
enableFlag: 'Y',
enableFlag: "Y",
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.resetForm("form");
},
@ -250,7 +331,7 @@ export default {
if (row != null) {
this.form.parentTypeId = row.machineryTypeId;
}
getMachinerytype(row.machineryTypeId).then(response => {
getMachinerytype(row.machineryTypeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改设备类型";
@ -258,16 +339,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.machineryTypeId != null) {
updateMachinerytype(this.form).then(response => {
updateMachinerytype(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMachinerytype(this.form).then(response => {
addMachinerytype(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -278,13 +359,19 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除设备类型编号为"' + row.machineryTypeId + '"的数据项?').then(function() {
this.$modal
.confirm(
'是否确认删除设备类型编号为"' + row.machineryTypeId + '"的数据项?'
)
.then(function () {
return delMachinerytype(row.machineryTypeId);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-row>
<el-col :span="8">
<el-form-item label="工作站编码" prop="workstationCode">
@ -24,7 +31,10 @@
</el-col>
<el-col :span="8">
<el-form-item label="所在车间名称" prop="workshopName">
<el-select v-model="queryParams.workshopId" placeholder="请选择车间">
<el-select
v-model="queryParams.workshopId"
placeholder="请选择车间"
>
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
@ -50,8 +60,16 @@
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-col>
</el-row>
@ -66,7 +84,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:md:workstation:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -77,7 +96,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:md:workstation:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -88,7 +108,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:md:workstation:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -98,12 +119,20 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:md:workstation:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="workstationList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="workstationList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工作站编号" align="center" prop="workstationCode">
<template slot-scope="scope">
@ -111,20 +140,40 @@
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:md:workstation:query']"
>{{scope.row.workstationCode}}</el-button>
>{{ scope.row.workstationCode }}</el-button
>
</template>
</el-table-column>
<el-table-column label="工作站名称" align="center" prop="workstationName" />
<el-table-column label="工作站地点" align="center" prop="workstationAddress" />
<el-table-column label="所在车间名称" align="center" prop="workshopName" />
<el-table-column
label="工作站名称"
align="center"
prop="workstationName"
/>
<el-table-column
label="工作站地点"
align="center"
prop="workstationAddress"
/>
<el-table-column
label="所在车间名称"
align="center"
prop="workshopName"
/>
<el-table-column label="所属工序" align="center" prop="processName" />
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
<dict-tag
:options="dict.type.sys_yes_no"
:value="scope.row.enableFlag"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -132,14 +181,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:workstation:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:workstation:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -158,33 +209,49 @@
<el-row>
<el-col :span="8">
<el-form-item label="工作站编号" prop="workstationCode">
<el-input v-model="form.workstationCode" placeholder="请输入工作站编码" />
<el-input
v-model="form.workstationCode"
placeholder="请输入工作站编码"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
<el-switch
v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
@change="handleAutoGenChange(autoGenFlag)"
v-if="optType != 'view'"
>
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作站名称" prop="workstationName">
<el-input v-model="form.workstationName" placeholder="请输入工作站名称" />
<el-input
v-model="form.workstationName"
placeholder="请输入工作站名称"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工作站地点" prop="workstationAddress">
<el-input v-model="form.workstationAddress" placeholder="请输入工作站地点" />
<el-input
v-model="form.workstationAddress"
placeholder="请输入工作站地点"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在车间" prop="workshopId">
<el-select v-model="form.workshopId" placeholder="请选择车间">
<el-select
v-model="form.workshopId"
style="width: 100%"
placeholder="请选择车间"
>
<el-option
v-for="item in workshopOptions"
:key="item.workshopId"
@ -196,33 +263,44 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="所属工序" prop="processId">
<el-select v-model="form.processId" placeholder="请选择工序">
<el-select
v-model="form.processId"
multiple
style="width: 100%"
placeholder="请选择工序"
>
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processId"
:value="item.processId + ''"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.enableFlag"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.enableFlag" v-else>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
@ -230,23 +308,45 @@
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider content-position="center" v-if="form.workstationId !=null">工作站资源</el-divider>
<MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
<el-divider content-position="center" v-if="form.workstationId != null"
>工作站资源</el-divider
>
<MachinerySelectSingle
ref="machinerySelect"
@onSelected="onMachineryAdd"
></MachinerySelectSingle>
<el-row v-if="form.workstationId != null">
<el-col :span=24>
<el-col :span="24">
<el-carousel trigger="click" type="card" :autoplay="false">
<el-carousel-item>
<el-card shadow="always" style="width: 450px">
<div slot="header">
<span>设备资源</span>
<el-button style="float:right; padding: 3px 0" @click="handleMachineryAdd" v-if="optType !='view'" type="text">新增</el-button>
<span v-if="optTypebutton">
<el-button
style="float: right; padding: 3px 0"
@click="handleMachineryAdd"
v-if="optType != 'view'"
type="text"
>新增</el-button
>
</span>
</div>
<WorkStationMachine ref="machineryList" :optType="optType" :workstationId="form.workstationId" style="align:center"></WorkStationMachine>
<WorkStationMachine
ref="machineryList"
:optType="optType"
:workstationId="form.workstationId"
style="align: center"
></WorkStationMachine>
</el-card>
</el-carousel-item>
<!-- <el-carousel-item>
@ -271,7 +371,9 @@
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" @click="cancel" v-if="optType == 'view'"
>返回</el-button
>
<el-button type="primary" @click="submitForm" v-else> </el-button>
<el-button @click="cancel"> </el-button>
</div>
@ -280,24 +382,39 @@
</template>
<script>
import { listWorkstation, getWorkstation, delWorkstation, addWorkstation, updateWorkstation } from "@/api/mes/md/workstation";
import {
listWorkstation,
getWorkstation,
delWorkstation,
addWorkstation,
updateWorkstation,
} from "@/api/mes/md/workstation";
//
import WorkStationMachine from "./components/machine";
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
import {addWorkstationmachine} from "@/api/mes/md/workstationmachine";
import {
listWorkstationmachine,
addWorkstationmachine,
} from "@/api/mes/md/workstationmachine";
//
import Workstationworker from "./components/worker";
//
import WorkStationTool from "./components/tool";
import {getTreeList} from "@/api/mes/wm/warehouse"
import { getTreeList } from "@/api/mes/wm/warehouse";
import { listAllProcess } from "@/api/mes/pro/process";
import { genCode } from "@/api/system/autocode/rule";
import { listAllWorkshop } from "@/api/mes/md/workshop";
export default {
name: "Workstation",
dicts: ['sys_yes_no'],
components: {WorkStationMachine,MachinerySelectSingle,Workstationworker,WorkStationTool},
dicts: ["sys_yes_no"],
components: {
WorkStationMachine,
MachinerySelectSingle,
Workstationworker,
WorkStationTool,
},
data() {
return {
//
@ -307,8 +424,8 @@ export default {
warehouseOptions: [],
warehouseProps: {
multiple: false,
value: 'pId',
label: 'pName',
value: "pId",
label: "pName",
},
//
loading: true,
@ -349,27 +466,29 @@ export default {
locationId: null,
areaId: null,
enableFlag: null,
workstationId: null,
},
optTypebutton: true,
//
form: {},
//
rules: {
workstationCode: [
{ required: true, message: "工作站编号不能为空", trigger: "blur" }
{ required: true, message: "工作站编号不能为空", trigger: "blur" },
],
workstationName: [
{ required: true, message: "工作站名称不能为空", trigger: "blur" }
{ required: true, message: "工作站名称不能为空", trigger: "blur" },
],
enableFlag: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
workshopId: [
{ required: true, message: "请选择所属车间", trigger: "blur" }
{ required: true, message: "请选择所属车间", trigger: "blur" },
],
processId: [
{ required: true, message: "请选择所属工序", trigger: "blur" }
]
}
{ required: true, message: "请选择所属工序", trigger: "blur" },
],
},
};
},
created() {
@ -382,7 +501,7 @@ export default {
/** 查询工作站列表 */
getList() {
this.loading = true;
listWorkstation(this.queryParams).then(response => {
listWorkstation(this.queryParams).then((response) => {
this.workstationList = response.rows;
this.total = response.total;
this.loading = false;
@ -390,31 +509,38 @@ export default {
},
//
getWorkshops() {
listAllWorkshop().then( response => {
listAllWorkshop().then((response) => {
this.workshopOptions = response.data;
});
},
//
getProcess() {
listAllProcess().then( response =>{
listAllProcess().then((response) => {
this.processOptions = response.data;
});
},
//
getWarehouseList() {
getTreeList().then( response =>{
getTreeList().then((response) => {
this.warehouseOptions = response.data;
this.warehouseOptions.map(w =>{
w.children.map(l =>{
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
this.warehouseOptions.map((w) => {
w.children.map((l) => {
let lstr = JSON.stringify(l.children)
.replace(/locationId/g, "lId")
.replace(/areaId/g, "pId")
.replace(/areaName/g, "pName");
l.children = JSON.parse(lstr);
});
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
let wstr = JSON.stringify(w.children)
.replace(/warehouseId/g, "wId")
.replace(/locationId/g, "pId")
.replace(/locationName/g, "pName");
w.children = JSON.parse(wstr);
});
let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');
let ostr = JSON.stringify(this.warehouseOptions)
.replace(/warehouseId/g, "pId")
.replace(/warehouseName/g, "pName");
this.warehouseOptions = JSON.parse(ostr);
});
},
@ -447,12 +573,12 @@ export default {
warehouseId: null,
locationId: null,
areaId: null,
enableFlag: 'Y',
enableFlag: "Y",
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.autoGenFlag = true;
this.resetForm("form");
@ -486,9 +612,9 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.workstationId)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.workstationId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
@ -497,7 +623,7 @@ export default {
this.open = true;
this.title = "添加工作站";
this.optType = "add";
genCode('WORKSTATION_CODE').then(response =>{
genCode("WORKSTATION_CODE").then((response) => {
this.form.workstationCode = response;
});
},
@ -506,7 +632,7 @@ export default {
this.reset();
this.getWorkshops();
const workstationId = row.workstationId || this.ids;
getWorkstation(workstationId).then(response => {
getWorkstation(workstationId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "查看车间信息";
@ -517,26 +643,41 @@ export default {
handleUpdate(row) {
this.reset();
this.getWorkshops();
const workstationId = row.workstationId || this.ids
getWorkstation(workstationId).then(response => {
const workstationId = row.workstationId || this.ids;
getWorkstation(workstationId).then((response) => {
this.form = response.data;
this.form.processId = response.data.processId.split(",");
console.log(this.form.processId);
this.open = true;
this.title = "修改工作站";
this.optType = "edit";
});
var queryParams = {
pageNum: 1,
pageSize: 1000,
workstationId: workstationId,
};
listWorkstationmachine(queryParams).then((response) => {
if (response.total == 1) {
this.optTypebutton = false;
} else {
this.optTypebutton = true;
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.workstationId != null) {
updateWorkstation(this.form).then(response => {
updateWorkstation(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWorkstation(this.form).then(response => {
this.form.processId = this.form.processId.join(",");
addWorkstation(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -548,23 +689,31 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const workstationIds = row.workstationId || this.ids;
this.$modal.confirm('是否确认删除工作站?').then(function() {
this.$modal
.confirm("是否确认删除工作站?")
.then(function () {
return delWorkstation(workstationIds);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/md/workstation/export', {
...this.queryParams
}, `workstation_${new Date().getTime()}.xlsx`)
this.download(
"mes/md/workstation/export",
{
...this.queryParams,
},
`workstation_${new Date().getTime()}.xlsx`
);
},
//
handleAutoGenChange(autoGenFlag) {
if (autoGenFlag) {
genCode('WORKSTATION_CODE').then(response =>{
genCode("WORKSTATION_CODE").then((response) => {
this.form.workstationCode = response;
});
} else {
@ -577,10 +726,10 @@ export default {
},
//
onMachineryAdd(rows) {
debugger
debugger;
this.loading = true;
rows.workstationId = this.form.workstationId;
addWorkstationmachine(rows).then(response =>{
addWorkstationmachine(rows).then((response) => {
this.$refs.machineryList.getList();
this.loading = false;
});
@ -592,7 +741,7 @@ export default {
//
handleToolTypeAdd() {
this.$refs.toolList.handleAdd();
}
}
},
},
};
</script>

View File

@ -97,16 +97,16 @@ export default {
type: "category",
boundaryGap: true, //
data: [
"2023-03",
"2023-04",
"2023-05",
"2023-06",
"2023-07",
"2023-08",
"2023-09",
"2023-10",
"2023-11",
"2023-12",
"2023-13",
"2023-14",
"2023-15",
"2023-16",
"2023-17",
],
axisLabel: {
//

View File

@ -0,0 +1,343 @@
<template>
<div class="videoMain" ref="playWndBox">
<div
id="playWnd"
class="playWnd"
:style="{
height: playWndHeight + 'px',
width: playWndWidth + 'px',
}"
></div>
</div>
</template>
<script>
export default {
name: "HikVideo",
data() {
return {
//
playWndHeight: "",
//
playWndWidth: "",
oWebControl: null,
initCount: 0,
pubKey: "",
cameraIndexCode: "", //
objData: {
appkey: "", //appkey
ip: "", //
secret: "", //secret
port: 443,
playMode: 0, // 0 1
layout: "2x2", //16
},
};
},
mounted() {
//
this.playWndHeight = this.$refs.playWndBox.clientHeight;
//
this.playWndWidth = this.$refs.playWndBox.clientWidth;
//
this.$nextTick(() => {
this.initPlugin();
});
// scroll使DIV
window.addEventListener("scroll", () => {
if (this.oWebControl != null) {
this.oWebControl.JS_Resize(
this.$refs.playWndBox.clientWidth,
this.$refs.playWndBox.clientHeight
);
this.setWndCover();
}
});
// resize使DIV
window.addEventListener("resize", (e) => {
if (this.oWebControl != null) {
this.oWebControl.JS_Resize(
this.$refs.playWndBox.clientWidth,
this.$refs.playWndBox.clientHeight
);
this.setWndCover();
}
});
},
destroyed() {
if (this.oWebControl != null) {
//
this.oWebControl.JS_HideWnd();
//
this.oWebControl.JS_RequestInterface({ funcName: "destroyWnd" });
//
this.oWebControl.JS_Disconnect();
}
},
methods: {
//
initPlugin() {
let that = this;
this.oWebControl = null;
that.oWebControl = new WebControl({
szPluginContainer: "playWnd", // id
iServicePortStart: 15900, // 使
iServicePortEnd: 15909,
szClassId: "23BF3B0A-2C56-4D97-9C03-0CB103AA8F11", // IE10使ActiveXclsid
cbConnectSuccess: () => {
// WebControl
that.oWebControl
.JS_StartService("window", {
// WebControl
// "./VideoPluginConnect.dll"
dllPath: "./VideoPluginConnect.dll",
})
.then(
function () {
//
that.oWebControl.JS_SetWindowControlCallback({
cbIntegrationCallBack: that.cbIntegrationCallBack,
});
//JS_CreateWnd
that.oWebControl
.JS_CreateWnd("playWnd", 2040, 945, { bEmbed: true })
//2040,945
.then(function () {
//
that.init();
});
},
function () {
//
}
);
},
// WebControl
cbConnectError: function () {
that.oWebControl = null;
// alert('...')
// that.$message.warning("...");
// errorwakeup
window.WebControl.JS_WakeUp("VideoWebPlugin://");
that.initCount++;
if (that.initCount < 3) {
setTimeout(function () {
that.initPlugin();
}, 3000);
} else {
// that.messageBox = true
// alert('')
// that.downloadHikVideo()
// setTimeout(function () {
// that.messageBox = false
// }, 5000)
// setTimeout(function () {
// alert('')
// that.$message({
// message: ' \n https://www.baidu.com',
// type: 'warning'
// });
// }, 5000)
}
},
cbConnectClose: () => {
// bNormalClose = false
// JS_DisconnectbNormalClose = true
// console.log("cbConnectClose");
that.oWebControl = null;
},
});
},
//
init(callback) {
let that = this;
that.getPubKey(() => {
let appkey = that.objData.appkey; //appkey
let secret = that.setEncrypt(that.objData.secret); //secret
let ip = that.objData.ip; //IP
let playMode = that.objData.playMode; //0-1-
let port = that.objData.port; //HTTPS443
let snapDir = "D:\\SnapDir"; //
let videoDir = "D:\\VideoDir"; //
let layout = that.objData.layout; //playMode
let enableHTTPS = 1; //HTTPS1
let encryptedFields = "secret"; //secret
let showToolbar = 1; //0-0-
let showSmart = 1; //线0-0-
let buttonIDs =
"0,16,256,257,258,259,260,512,513,514,515,516,517,768,769"; //
// var toolBarButtonIDs = "2049,2304" //
that.oWebControl
.JS_RequestInterface({
funcName: "init",
argument: JSON.stringify({
appkey: appkey, //APIappkey
secret: secret, //APIsecret
ip: ip, //APIIP
playMode: playMode, //
port: port, //
snapDir: snapDir, //
videoDir: videoDir, //
layout: layout, //
enableHTTPS: enableHTTPS, //HTTPS
encryptedFields: encryptedFields, //
showToolbar: showToolbar, //
showSmart: showSmart, //
buttonIDs, //
}),
})
.then(function (oData) {
that.oWebControl.JS_Resize(that.playWndWidth, that.playWndHeight); // resizefirefoxDIV
if (callback) {
callback();
}
//
// that.oWebControl.JS_HideWnd()
});
});
},
//
getPubKey(callback) {
let that = this;
this.oWebControl
.JS_RequestInterface({
funcName: "getRSAPubKey",
argument: JSON.stringify({
keyLength: 1024,
}),
})
.then(function (oData) {
if (oData.responseMsg.data) {
that.pubKey = oData.responseMsg.data;
callback();
}
});
},
// RSA
setEncrypt(value) {
let that = this;
let encrypt = new window.JSEncrypt();
encrypt.setPublicKey(that.pubKey);
return encrypt.encrypt(value);
},
//
cbIntegrationCallBack(oData) {
let { responseMsg: type } = oData;
if (type === "error") {
} else {
}
},
//
previewVideo(data) {
let that = this;
let cameraIndexCode = data; //
let streamMode = 0; // 0-1-
let transMode = 0; // 0-UDP1-TCP
let gpuMode = 0; // GPU0-1-
let wndId = -1; // 2x2
// console.log(cameraIndexCode, "-------cameraIndexCode-");
that.oWebControl.JS_RequestInterface({
funcName: "startPreview",
argument: JSON.stringify({
cameraIndexCode: cameraIndexCode.trim(), //
streamMode: streamMode, //
transMode: transMode, //
gpuMode: gpuMode, // GPU
wndId: wndId, //
}),
});
},
//
stopAllPreview() {
this.oWebControl.JS_RequestInterface({
funcName: "stopAllPreview",
});
},
//
dateFormat(oDate, fmt) {
let o = {
"M+": oDate.getMonth() + 1, //
"d+": oDate.getDate(), //
"h+": oDate.getHours(), //
"m+": oDate.getMinutes(), //
"s+": oDate.getSeconds(), //
"q+": Math.floor((oDate.getMonth() + 3) / 3), //
S: oDate.getMilliseconds(), //
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
(oDate.getFullYear() + "").substr(4 - RegExp.$1.length)
);
}
for (let k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(
RegExp.$1,
RegExp.$1.length == 1
? o[k]
: ("00" + o[k]).substr(("" + o[k]).length)
);
}
}
return fmt;
},
// JS_CuttingPartWindow
setWndCover() {
var iWidth = $(window).width();
var iHeight = $(window).height();
var oDivRect = $("#playWnd").get(0).getBoundingClientRect();
var iCoverLeft = oDivRect.left < 0 ? Math.abs(oDivRect.left) : 0;
var iCoverTop = oDivRect.top < 0 ? Math.abs(oDivRect.top) : 0;
var iCoverRight =
oDivRect.right - iWidth > 0 ? Math.round(oDivRect.right - iWidth) : 0;
var iCoverBottom =
oDivRect.bottom - iHeight > 0
? Math.round(oDivRect.bottom - iHeight)
: 0;
iCoverLeft = iCoverLeft > 2041 ? 2041 : iCoverLeft;
iCoverTop = iCoverTop > 945 ? 945 : iCoverTop;
iCoverRight = iCoverRight > 2041 ? 2041 : iCoverRight;
iCoverBottom = iCoverBottom > 945 ? 945 : iCoverBottom;
this.oWebControl.JS_RepairPartWindow(0, 0, 2041, 946); // 1
if (iCoverLeft != 0) {
this.oWebControl.JS_CuttingPartWindow(0, 0, iCoverLeft, 946);
}
if (iCoverTop != 0) {
this.oWebControl.JS_CuttingPartWindow(0, 0, 2041, iCoverTop); //
}
if (iCoverRight != 0) {
this.oWebControl.JS_CuttingPartWindow(
2041 - iCoverRight,
0,
iCoverRight,
946
);
}
if (iCoverBottom != 0) {
this.oWebControl.JS_CuttingPartWindow(
0,
946 - iCoverBottom,
2041,
iCoverBottom
);
}
},
},
};
</script>
<style lang="scss" scoped>
.videoMain {
width: 100%;
height: 100%;
}
</style>

View File

@ -139,12 +139,19 @@
<!-- 第二部分 -->
<div style="height: 75%">
<div style="height: 50%; display: flex">
<div style="width: 80%">
<div style="width: 45%">
<ticket :message="this.ticketData" />
</div>
<div style="width: 24%; margin-top: 50px">
<defective :message="this.defectiveData" />
</div>
<div style="width: 30%; margin-top: 50px">
<hkVideo
:cameraIndexCode="cameraIndexCode"
:objData="objData"
ref="hikVideo"
></hkVideo>
</div>
</div>
<div style="height: 50%; display: flex">
<div style="width: 45%">
@ -252,11 +259,24 @@ import screenfull from "screenfull";
import defective from "./components/defective.vue";
import complete from "./components/complete.vue";
import ticket from "./components/ticket.vue";
import hkVideo from "./components/video.vue";
export default {
components: { defective, complete, ticket },
components: { defective, complete, ticket, hkVideo },
data() {
return {
cameraIndexCode: "", //wed
//wed
objData: {
appkey: "", //appkey
ip: "", //IP
secret: "", //secret
port: 443, //HTTPS443
playMode: 0, // 0 1
layout: "2x2", //16
showToolbar: 1, //0-0-
},
screenfull: false,
title: "生产监控分析",
titleVisible: false,

View File

@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="工艺路线编号" prop="routeCode">
<el-input
v-model="queryParams.routeCode"
@ -26,8 +33,16 @@
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
@ -40,7 +55,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:pro:proroute:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -51,7 +67,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:pro:proroute:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -62,7 +79,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:pro:proroute:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -72,12 +90,20 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:pro:proroute:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="prorouteList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="prorouteList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工艺路线编号" align="center" prop="routeCode">
<template slot-scope="scope">
@ -85,18 +111,26 @@
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:pro:proroute:query']"
>{{scope.row.routeCode}}</el-button>
>{{ scope.row.routeCode }}</el-button
>
</template>
</el-table-column>
<el-table-column label="工艺路线名称" align="center" prop="routeName" />
<el-table-column label="工艺路线说明" align="center" prop="routeDesc" />
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
<dict-tag
:options="dict.type.sys_yes_no"
:value="scope.row.enableFlag"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -104,14 +138,19 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:pro:proroute:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:pro:proroute:remove']"
>删除</el-button>
>删除</el-button
>
<el-button size="mini" type="text" @click="handlecopy(scope.row)"
>复制</el-button
>
</template>
</el-table-column>
</el-table>
@ -125,43 +164,63 @@
/>
<!-- 添加或修改工艺路线对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1080px" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
width="1080px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item label="编号" prop="routeCode">
<el-input v-model="form.routeCode" placeholder="请输入工艺路线编号" />
<el-input
v-model="form.routeCode"
placeholder="请输入工艺路线编号"
/>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
<el-switch
v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
@change="handleAutoGenChange(autoGenFlag)"
v-if="optType != 'view'"
>
</el-switch>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="名称" prop="routeName">
<el-input v-model="form.routeName" placeholder="请输入工艺路线名称" />
<el-input
v-model="form.routeName"
placeholder="请输入工艺路线名称"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="是否启用" prop="enableFlag">
<el-radio-group v-model="form.enableFlag" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.enableFlag"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.enableFlag" v-else>
<el-radio
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
@ -169,28 +228,46 @@
<el-row>
<el-col :span="24">
<el-form-item label="说明" prop="routeDesc">
<el-input v-model="form.routeDesc" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.routeDesc"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-if="form.routeId != null">
<el-tab-pane label="组成工序">
<Routeprocess v-if="form.routeId !=null" :optType="optType" :routeId="form.routeId"></Routeprocess>
<Routeprocess
v-if="form.routeId != null"
:optType="optType"
:routeId="form.routeId"
></Routeprocess>
</el-tab-pane>
<el-tab-pane label="关联产品">
<Routeproduct v-if="form.routeId !=null" :optType="optType" :routeId="form.routeId"></Routeproduct>
<Routeproduct
v-if="form.routeId != null"
:optType="optType"
:routeId="form.routeId"
></Routeproduct>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" @click="cancel" v-if="optType == 'view'"
>返回</el-button
>
<el-button type="primary" @click="submitForm" v-else> </el-button>
<el-button @click="cancel"> </el-button>
</div>
@ -199,13 +276,20 @@
</template>
<script>
import { listProroute, getProroute, delProroute, addProroute, updateProroute } from "@/api/mes/pro/proroute";
import {
listProroute,
getProroute,
delProroute,
addProroute,
updateProroute,
copyProRoute,
} from "@/api/mes/pro/proroute";
import Routeprocess from "./routeprocess";
import Routeproduct from "./product";
import {genCode} from "@/api/system/autocode/rule"
import { genCode } from "@/api/system/autocode/rule";
export default {
name: "Proroute",
dicts: ['sys_yes_no'],
dicts: ["sys_yes_no"],
components: { Routeprocess, Routeproduct },
data() {
return {
@ -244,15 +328,15 @@ export default {
//
rules: {
routeCode: [
{ required: true, message: "工艺路线编号不能为空", trigger: "blur" }
{ required: true, message: "工艺路线编号不能为空", trigger: "blur" },
],
routeName: [
{ required: true, message: "工艺路线名称不能为空", trigger: "blur" }
{ required: true, message: "工艺路线名称不能为空", trigger: "blur" },
],
enableFlag: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
}
},
};
},
created() {
@ -262,7 +346,7 @@ export default {
/** 查询工艺路线列表 */
getList() {
this.loading = true;
listProroute(this.queryParams).then(response => {
listProroute(this.queryParams).then((response) => {
this.prorouteList = response.rows;
this.total = response.total;
this.loading = false;
@ -280,12 +364,12 @@ export default {
routeCode: null,
routeName: null,
routeDesc: null,
enableFlag: 'Y',
enableFlag: "Y",
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.autoGenFlag = true;
this.resetForm("form");
@ -302,9 +386,9 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.routeId)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.routeId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
@ -312,7 +396,7 @@ export default {
this.open = true;
this.title = "添加工艺路线";
this.optType = "add";
genCode('ROUTE_CODE').then(response =>{
genCode("ROUTE_CODE").then((response) => {
this.form.routeCode = response;
});
},
@ -320,7 +404,7 @@ export default {
handleView(row) {
this.reset();
const routeId = row.routeId || this.ids;
getProroute(routeId).then(response => {
getProroute(routeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "查看工艺线路信息";
@ -330,8 +414,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const routeId = row.routeId || this.ids
getProroute(routeId).then(response => {
const routeId = row.routeId || this.ids;
getProroute(routeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改工艺路线";
@ -340,16 +424,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.routeId != null) {
updateProroute(this.form).then(response => {
updateProroute(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProroute(this.form).then(response => {
addProroute(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -361,29 +445,52 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const routeIds = row.routeId || this.ids;
this.$modal.confirm('是否确认删除工艺路线编号为"' + routeIds + '"的数据项?').then(function() {
this.$modal
.confirm('是否确认删除?')
.then(function () {
return delProroute(routeIds);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
})
.catch(() => {});
},
handlecopy(row) {
const routeId = row.routeId || this.ids;
copyProRoute(routeId).then((response) => {
this.$modal
.confirm("是否确认复制?")
.then(function () {
return delProroute(routeId);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("复制成功");
})
.catch(() => {});
});
},
/** 导出按钮操作 */
handleExport() {
this.download('pro/proroute/export', {
...this.queryParams
}, `proroute_${new Date().getTime()}.xlsx`)
this.download(
"pro/proroute/export",
{
...this.queryParams,
},
`proroute_${new Date().getTime()}.xlsx`
);
},
//
handleAutoGenChange(autoGenFlag) {
if (autoGenFlag) {
genCode('ROUTE_CODE').then(response =>{
genCode("ROUTE_CODE").then((response) => {
this.form.routeCode = response;
});
} else {
this.form.routeCode = null;
}
}
}
},
},
};
</script>

View File

@ -164,7 +164,7 @@
>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="序号" prop="orderNum">
<el-input-number
:min="1"
@ -173,7 +173,18 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="工序类型" prop="processTypeId">
<treeselect
v-model="form.processTypeId"
:options="machineryTypeOptions1"
:normalizer="normalizer1"
placeholder="请选择工序类型"
@select="handleNodeProcess"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="工序" prop="processId">
<el-select v-model="form.processId" placeholder="请选择工序">
<el-option
@ -311,40 +322,16 @@
placeholder="请选择设备类型"
@select="handleNodeClick"
/>
<!-- :disable-branch-nodes="true" -->
</el-form-item>
</el-col>
<!-- <el-col :span="12"> -->
<el-col :span="12" v-if="Typefile">
<!-- <el-form-item label="代码上传" prop="">
<el-upload
ref="codeName"
class="upload-demo"
:headers="this.headers"
action="/prod-api/common/uploadMinio"
:before-remove="beforeRemove"
:on-change="customUploadChangeImage2"
:before-upload="beforeUpload"
:on-exceed="handleExceedImage1"
accept=".PDF"
name="file"
multiple
:limit="1"
:file-list="fileList"
<el-col
:span="12"
v-if="this.form.code == 'CNC' || this.form.code == 'ROBOT'"
>
<el-button size="small" type="primary" icon="el-icon-upload2"
>点击上传</el-button
>
<el-button type="primary" size="small" @click.stop="previewFile"
>&nbsp;预览文件</el-button
>
</el-upload>
</el-form-item> -->
<el-form-item label="代码上传" prop="url">
<el-form-item label="选择代码" prop="url">
<el-select
v-model="form.originalName"
value-key="codeId"
placeholder="请选择工序"
@change="selectSource($event)"
>
<el-option
@ -358,7 +345,7 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-if="warehousing">
<el-col :span="12" v-if="this.form.code == 'STORE'">
<el-form-item label="选择出入库类型" prop="exitType">
<el-radio-group v-model="form.exitType">
<el-radio label="0">出库</el-radio>
@ -368,7 +355,44 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-if="TypeId">
<el-col
:span="12"
v-if="
this.form.code == 'AGV_TRANSMIT' ||
this.form.code == 'TRANSMIT' ||
this.form.code == 'ROBOT_TRANSMIT'
"
>
<el-form-item label="传送带转动方向" prop="rotationDirection">
<el-radio-group v-model="form.rotationDirection">
<el-radio label="0">正转</el-radio>
<el-radio label="1">反转</el-radio>
<el-radio label="2">停止</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="this.form.code == 'ROBOT_TRANSMIT'">
<el-form-item label="传送带位置" prop="conveyNumber">
<el-radio-group v-model="form.conveyNumber">
<el-radio label="1">1号传送带</el-radio>
<el-radio label="2">2号传送带</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span="12"
v-if="this.form.code == 'CNC' || this.form.code == 'ROBOT'"
>
<el-form-item label="安全门状态" prop="securityDoor">
<el-radio-group v-model="form.securityDoor">
<el-radio label="0">开启</el-radio>
<el-radio label="1">关闭</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12" v-if="this.form.code == 'AGV'">
<el-form-item label="选择线路" prop="lineId">
<el-select
v-model="form.lineId"
@ -385,7 +409,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if="TypeId">
<el-col :span="12" v-if="this.form.code == 'AGV'">
<el-form-item label="选择点位" prop="pointId">
<el-select
v-model="form.pointId"
@ -437,9 +461,13 @@ import {
addRouteprocess,
updateRouteprocess,
} from "@/api/mes/pro/routeprocess";
import { listAllProcess } from "@/api/mes/pro/process";
import { listProcess } from "@/api/mes/pro/process";
import { getToken } from "@/utils/auth";
import { listMachinerytype } from "@/api/mes/dv/machinerytype";
import {
listMachinerytype,
getMachinerytype,
} from "@/api/mes/dv/machinerytype";
import * as listType from "@/api/mes/pro/processType";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
@ -489,6 +517,7 @@ export default {
},
//
machineryTypeOptions: [],
machineryTypeOptions1: [],
fileList: [],
//线
workshopOptions: [],
@ -505,6 +534,7 @@ export default {
url: "",
lineId: "",
pointId: "",
code: null,
},
machineryList: [],
//
@ -532,6 +562,9 @@ export default {
trigger: "blur",
},
],
processTypeId: [
{ required: true, message: "请选择工序类型", trigger: "blur" },
],
idid: [
{ required: true, message: "请选择是否工艺节点", trigger: "blur" },
],
@ -544,7 +577,7 @@ export default {
},
created() {
this.getList();
this.getProcess();
// this.getProcess();
this.getTreeselect();
this.getWorkshops();
},
@ -558,12 +591,12 @@ export default {
this.loading = false;
});
},
//
getProcess() {
listAllProcess().then((response) => {
this.processOptions = response.data;
});
},
// //
// getProcess() {
// listAllProcess().then((response) => {
// this.processOptions = response.data;
// });
// },
getWorkshops() {
findProAgvline().then((response) => {
this.workshopOptions = response.rows;
@ -583,6 +616,15 @@ export default {
)[0];
this.machineryTypeOptions.push(data);
});
listType.listMachinerytype().then((response) => {
this.machineryTypeOptions1 = [];
const data = this.handleTree(
response.data,
"processTypeId",
"parentTypeId"
)[0];
this.machineryTypeOptions1.push(data);
});
},
/** 转换设备类型数据结构 */
normalizer(node) {
@ -595,28 +637,47 @@ export default {
children: node.children,
};
},
/** 转换设备类型数据结构 */
normalizer1(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.processTypeId,
label: node.processTypeName,
children: node.children,
};
},
//
handleNodeClick(data) {
if (data.machineryTypeId == 229) {
this.TypeId = true;
this.Typefile = false;
this.warehousing = false;
console.log(data);
if (data.code == "AGV") {
// this.TypeId = true;
// this.Typefile = false;
// this.warehousing = false;
this.form.originalName = "";
this.form.url = "";
this.form.exitType = "";
} else if (data.machineryTypeId == 230) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = true;
} else if (data.code == "STORE") {
// this.TypeId = false;
// this.Typefile = false;
// this.warehousing = true;
this.form.lineId = "";
this.form.pointId = "";
this.form.exitType = "0";
this.form.originalName = "";
this.form.url = "";
} else if (data.code == "CNC" || data.code == "ROBOT") {
// this.TypeId = false;
// this.Typefile = false;
// this.warehousing = true;
this.form.lineId = "";
this.form.pointId = "";
this.form.exitType = "";
} else {
this.TypeId = false;
this.Typefile = true;
this.warehousing = false;
// this.TypeId = false;
// this.Typefile = false;
// this.warehousing = false;
this.form.lineId = "";
this.form.pointId = "";
this.form.exitType = "";
@ -624,11 +685,18 @@ export default {
this.form.url = "";
}
this.form.machineryTypeName = data.machineryTypeName;
var queryParams = { machineryTypeId: data.machineryTypeId };
list(queryParams).then((response) => {
this.form.code = data.code;
var arr = { machineryTypeId: data.machineryTypeId };
list(arr).then((response) => {
this.machineryList = response.data;
});
},
handleNodeProcess(data) {
var arr = { processTypeId: data.processTypeId };
listProcess(arr).then((response) => {
this.processOptions = response.rows;
});
},
selectSource(e) {
console.log(e);
this.form.url = e.url;
@ -724,6 +792,10 @@ export default {
lineId: null,
pointId: null,
exitType: "0",
rotationDirection: "0",
processTypeId: null,
code: null,
securityDoor: null,
};
this.fileList = [];
this.resetForm("form");
@ -747,7 +819,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
if (this.form.machineryTypeId == null) {
if (this.form.code == null) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = false;
@ -770,40 +842,21 @@ export default {
const recordId = row.recordId || this.ids;
getRouteprocess(recordId).then((response) => {
this.form = response.data;
getMachinerytype(row.machineryTypeId).then((response) => {
this.form.code = response.data.code;
this.open = true;
this.title = "修改工艺组成";
});
if (row.machineryTypeId == null) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = false;
} else {
if (row.machineryTypeId == 229) {
this.TypeId = true;
this.Typefile = false;
this.warehousing = false;
// this.form.originalName = "";
// this.form.url = "";
// this.form.exitType = "";
} else if (row.machineryTypeId == 230) {
this.TypeId = false;
this.Typefile = false;
this.warehousing = true;
// this.form.lineId = "";
// this.form.pointId = "";
} else {
this.TypeId = false;
this.Typefile = true;
this.warehousing = false;
// this.form.lineId = "";
// this.form.pointId = "";
// this.form.exitType = "";
}
}
var queryParams = { machineryTypeId: row.machineryTypeId };
list(queryParams).then((response) => {
});
var arr = { machineryTypeId: row.machineryTypeId };
list(arr).then((response) => {
this.machineryList = response.data;
});
var arr1 = { processTypeId: row.processTypeId };
listProcess(arr1).then((response) => {
this.processOptions = response.rows;
});
var name = {};
if (row.originalName != undefined && row.originalName != "") {
this.$set(name, "name", row.originalName);
@ -815,13 +868,6 @@ export default {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.recordId != null) {
// if (this.form.machineryTypeId == 229) {
// this.form.originalName = "";
// this.form.url = "";
// } else {
// this.form.lineId = "";
// this.form.pointId = "";
// }
updateRouteprocess(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;

View File

@ -117,7 +117,7 @@
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
<el-col :span="1.5">
<el-button type="primary" plain size="mini" @click="production"
<el-button type="primary" plain size="mini" @click="handleproductione"
>批量执行生产</el-button
>
</el-col>
@ -234,7 +234,7 @@
size="mini"
type="text"
icon="el-icon-edit"
v-if="scope.row.status == 'CONFIRMED'"
v-if="scope.row.status == 'PRODUCTION'"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:pro:protask:edit']"
>排产</el-button
@ -242,10 +242,24 @@
<el-button
size="mini"
type="text"
v-if="scope.row.status == 'CONFIRMED'"
v-if="scope.row.status == 'PRODUCTION'"
@click="handleproductione(scope.row)"
>执行生产</el-button
>
<el-button
size="mini"
type="text"
v-if="scope.row.status == 'WORKING'"
@click="Pendingproduction(scope.row)"
>暂停生产</el-button
>
<el-button
size="mini"
type="text"
v-if="scope.row.status == 'SUSPENDED'"
@click="handleSuspended(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -259,7 +273,12 @@
/>
<!-- 添加或修改生产工单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
width="1550px"
append-to-body
>
<el-form ref="form" :model="form" label-width="80px">
<el-row>
<el-col :span="12">
@ -274,7 +293,7 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="来源类型" prop="orderSource">
<el-radio-group v-model="form.orderSource" disabled>
<el-radio
@ -286,12 +305,12 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8" v-if="form.orderSource == 'ORDER'">
<el-col :span="12" v-if="form.orderSource == 'ORDER'">
<el-form-item label="订单编号" prop="sourceCode">
<el-input v-model="form.sourceCode" readonly="readonly" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="12">
<el-form-item label="排产状态" prop="status">
<el-select v-model="form.status" disabled>
<el-option
@ -374,6 +393,7 @@
</el-col>
</el-row>
</el-form>
<el-scrollbar style="height: 100%; background: #f5f7fa">
<el-steps
:active="activeProcess"
v-if="form.workorderId != null"
@ -387,6 +407,8 @@
>
</el-step>
</el-steps>
</el-scrollbar>
<el-card
v-for="(item, index) in processOptions"
:key="index"
@ -397,6 +419,7 @@
:routeId="item.routeId"
:processId="item.processId"
:colorCode="item.colorCode"
:orderNum="item.orderNum"
:optType="optType"
:recordId="item.recordId"
></ProTask>
@ -431,6 +454,7 @@
</template>
<script>
import axios from "axios";
import {
listWorkorder,
getWorkorder,
@ -511,6 +535,7 @@ export default {
},
//
form: {},
ids: "",
};
},
created() {
@ -634,14 +659,60 @@ export default {
},
//
handleSelectionChange(selection) {
var ids = [];
ids = selection.map((item) => item.routeId);
this.ids = selection.map((item) => item.workorderId);
},
//
handleproductione(row) {
const routeId = row.workorderId || this.ids;
axios
.get("http://192.168.3.53:8077/manage/task/execute?ids=" + routeId)
// .get("http://127.0.0.1:8077/manage/task/execute?ids=" + routeId)
.then((res) => {
if (res.data.code === 200) {
this.getList();
this.$modal.msgSuccess("执行成功");
} else {
this.$message.error(res.data.msg);
}
});
},
//
Pendingproduction(row) {
const routeId = row.workorderId || this.ids;
axios
.get("http://192.168.3.53:8077/manage/task/suspension?id=" + routeId)
// .get("http://127.0.0.1:8077/manage/task/suspension?id=" + routeId)
.then((res) => {
if (res.data.code === 200) {
this.getList();
this.$modal.msgSuccess("已暂停");
} else {
this.$message.error(res.data.msg);
}
});
},
//
handleSuspended(row) {
// const workorderIds = row.workorderId || this.ids;
// this.$modal
// .confirm("")
// .then(function () {
// return dofinish(workorderIds); //
// })
// .then(() => {
// if (res.data.code === 200) {
// this.getList();
// this.$modal.msgSuccess("");
// } else {
// this.$message.error(res.data.msg);
// }
// })
// .catch(() => {});
},
production() {},
handleproductione() {},
selectable(row, index) {
if (row.status == "WORKING") {
if (row.status == "WORKING" || row.status == "PREPARE") {
return false;
} else {
return true;

View File

@ -70,7 +70,7 @@
<el-color-picker v-model="scope.row.colorCode" disabled></el-color-picker>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100px" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="150px" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@ -220,6 +220,7 @@ export default {
endTime: null,
colorCode: null,
requestDate: null,
orderNum: this.orderNum,
},
//
form: {},
@ -246,7 +247,8 @@ export default {
routeId: null,
processId: null,
optType: null,
recordId:null
recordId:null,
orderNum:null,
},
created() {
this.getList();

View File

@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="工单编码" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
@ -68,16 +75,26 @@
/>
</el-form-item>
<el-form-item label="需求日期" prop="requestDate">
<el-date-picker clearable
<el-date-picker
clearable
v-model="queryParams.requestDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择需求日期">
placeholder="请选择需求日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
@ -90,7 +107,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:pro:workorder:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -101,7 +119,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:pro:workorder:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -112,7 +131,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:pro:workorder:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -122,9 +142,13 @@
size="mini"
@click="handleExport"
v-hasPermi="['mes:pro:workorder:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
@ -141,42 +165,104 @@
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:pro:workorder:query']"
>{{scope.row.workorderCode}}</el-button>
>{{ scope.row.workorderCode }}</el-button
>
</template>
</el-table-column>
<el-table-column label="工单名称" width="200" align="center" prop="workorderName" :show-overflow-tooltip="true"/>
<el-table-column
label="工单名称"
width="200"
align="center"
prop="workorderName"
:show-overflow-tooltip="true"
/>
<el-table-column label="工单类型" align="center" prop="workorderType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType"/>
<dict-tag
:options="dict.type.mes_workorder_type"
:value="scope.row.workorderType"
/>
</template>
</el-table-column>
<el-table-column label="工单来源" align="center" prop="orderSource">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_sourcetype" :value="scope.row.orderSource"/>
<dict-tag
:options="dict.type.mes_workorder_sourcetype"
:value="scope.row.orderSource"
/>
</template>
</el-table-column>
<el-table-column label="订单编号" width="140" align="center" prop="sourceCode" />
<el-table-column label="产品编号" width="120" align="center" prop="productCode" />
<el-table-column label="产品名称" width="200" align="center" prop="productName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="productSpc" :show-overflow-tooltip="true"/>
<el-table-column
label="订单编号"
width="140"
align="center"
prop="sourceCode"
/>
<el-table-column
label="产品编号"
width="120"
align="center"
prop="productCode"
/>
<el-table-column
label="产品名称"
width="200"
align="center"
prop="productName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="规格型号"
align="center"
prop="productSpc"
:show-overflow-tooltip="true"
/>
<el-table-column label="单位" align="center" prop="unitOfMeasure" />
<el-table-column label="计划数量" align="center" prop="quantity" />
<el-table-column label="调整数量" align="center" prop="quantityChanged" />
<el-table-column label="已生产数量" align="center" width="100px" prop="quantityProduced" />
<el-table-column label="批次号" align="center" width="100px" prop="batchCode" />
<el-table-column
label="已生产数量"
align="center"
width="100px"
prop="quantityProduced"
/>
<el-table-column
label="批次号"
align="center"
width="100px"
prop="batchCode"
/>
<el-table-column label="客户编码" align="center" prop="clientCode" />
<el-table-column label="客户名称" align="center" prop="clientName" :show-overflow-tooltip="true"/>
<el-table-column label="需求日期" align="center" prop="requestDate" width="180">
<el-table-column
label="客户名称"
align="center"
prop="clientName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="需求日期"
align="center"
prop="requestDate"
width="180"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.requestDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.requestDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="单据状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
<dict-tag
:options="dict.type.mes_order_status"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
width="150px"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -185,15 +271,20 @@
v-if="scope.row.status == 'PREPARE'"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:pro:workorder:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
v-if="scope.row.status =='CONFIRMED' && scope.row.workorderType =='SELF'"
v-if="
scope.row.status == 'CONFIRMED' &&
scope.row.workorderType == 'SELF'
"
@click="handleAdd(scope.row)"
v-hasPermi="['mes:pro:workorder:update']"
>新增</el-button>
>新增</el-button
>
<el-button
size="mini"
type="text"
@ -201,7 +292,8 @@
v-if="scope.row.status == 'CONFIRMED'"
@click="handleFinish(scope.row)"
v-hasPermi="['mes:pro:workorder:update']"
>完成</el-button>
>完成</el-button
>
<el-button
size="mini"
type="text"
@ -209,7 +301,8 @@
v-if="scope.row.status == 'PREPARE'"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:pro:workorder:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@ -227,51 +320,73 @@
<el-row>
<el-col :span="8">
<el-form-item label="工单编号" prop="workorderCode">
<el-input v-model="form.workorderCode" placeholder="请输入工单编号" />
<el-input
v-model="form.workorderCode"
placeholder="请输入工单编号"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="80">
<el-switch v-model="autoGenFlag"
<el-switch
v-model="autoGenFlag"
active-color="#13ce66"
active-text="自动生成"
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view' && form.status =='PREPARE'">
@change="handleAutoGenChange(autoGenFlag)"
v-if="optType != 'view' && form.status == 'PREPARE'"
>
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工单名称" prop="workorderName">
<el-input v-model="form.workorderName" placeholder="请输入工单名称" />
<el-input
v-model="form.workorderName"
placeholder="请输入工单名称"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="来源类型" prop="orderSource">
<el-radio-group v-model="form.orderSource" disabled v-if="optType=='view'">
<el-radio-group
v-model="form.orderSource"
disabled
v-if="optType == 'view'"
>
<el-radio
v-for="dict in dict.type.mes_workorder_sourcetype"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
<el-radio-group v-model="form.orderSource" v-else>
<el-radio
v-for="dict in dict.type.mes_workorder_sourcetype"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
>{{ dict.label }}</el-radio
>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8" v-if="form.orderSource == 'ORDER'">
<el-form-item label="订单编号" prop="sourceCode">
<el-input v-model="form.sourceCode" placeholder="请输入订单编号" />
<el-input
v-model="form.sourceCode"
placeholder="请输入订单编号"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据状态" prop="status">
<el-select v-model="form.status" disabled placeholder="请选择单据状态">
<el-select
v-model="form.status"
disabled
placeholder="请选择单据状态"
>
<el-option
v-for="dict in dict.type.mes_order_status"
:key="dict.value"
@ -298,42 +413,65 @@
<el-col :span="8">
<el-form-item label="产品编号" prop="productCode">
<el-input v-model="form.productCode" placeholder="请选择产品">
<el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
<el-button
slot="append"
@click="handleSelectProduct"
icon="el-icon-search"
></el-button>
</el-input>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected">
</ItemSelect>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="productName">
<el-input v-model="form.productName" placeholder="请选择产品" disabled/>
<el-input
v-model="form.productName"
placeholder="请选择产品"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="规格型号" prop="productSpc">
<el-input v-model="form.productSpc" placeholder="请选择产品" disabled/>
<el-input
v-model="form.productSpc"
placeholder="请选择产品"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unitOfMeasure">
<el-input v-model="form.unitOfMeasure" placeholder="请选择产品" disabled/>
<el-input
v-model="form.unitOfMeasure"
placeholder="请选择产品"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="计划数量" prop="quantity">
<el-input-number :min="1" v-model="form.quantity" placeholder="请输入计划数量" />
<el-input-number
:min="1"
v-model="form.quantity"
placeholder="请输入计划数量"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="需求日期" prop="requestDate">
<el-date-picker clearable
<el-date-picker
clearable
v-model="form.requestDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择需求日期">
placeholder="请选择需求日期"
>
</el-date-picker>
</el-form-item>
</el-col>
@ -343,34 +481,66 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工件数量" prop="workpieceType">
<el-radio-group v-model="form.workpieceType">
<el-radio label="1">一个托盘单工件</el-radio>
<el-radio label="0">一个托盘多工件</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.orderSource == 'ORDER'">
<el-col :span="12">
<el-form-item label="客户编码" prop="clientCode">
<el-input v-model="form.clientCode" placeholder="请选择客户">
<el-button slot="append" @click="handleSelectClient" icon="el-icon-search"></el-button>
<el-button
slot="append"
@click="handleSelectClient"
icon="el-icon-search"
></el-button>
</el-input>
<ClientSelect ref="clientSelect" @onSelected="onClientSelected" > </ClientSelect>
<ClientSelect ref="clientSelect" @onSelected="onClientSelected">
</ClientSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="clientName">
<el-input v-model="form.clientName" readonly="readonly" placeholder="请输入客户名称" />
<el-input
v-model="form.clientName"
readonly="readonly"
placeholder="请输入客户名称"
/>
</el-form-item>
</el-col>
<el-col></el-col>
</el-row>
<el-row v-if="form.workorderType == 'OUTSOURCE' || form.workorderType == 'PURCHASE'">
<el-row
v-if="
form.workorderType == 'OUTSOURCE' ||
form.workorderType == 'PURCHASE'
"
>
<el-col :span="12">
<el-form-item label="供应商编码" prop="vendorCode">
<el-input v-model="form.vendorCode" placeholder="请选择供应商">
<el-button slot="append" @click="handleSelectVendor" icon="el-icon-search"></el-button>
<el-button
slot="append"
@click="handleSelectVendor"
icon="el-icon-search"
></el-button>
</el-input>
<VendorSelect ref="vendorSelect" @onSelected="onVendorSelected" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称" prop="vendorName">
<el-input v-model="form.vendorName" readonly="readonly" placeholder="请选择供应商" />
<el-input
v-model="form.vendorName"
readonly="readonly"
placeholder="请选择供应商"
/>
</el-form-item>
</el-col>
<el-col></el-col>
@ -383,23 +553,49 @@
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-if="form.workorderId != null">
<el-tab-pane label="BOM组成">
<Workorderbom ref="bomlist" :optType="optType" :workorder="form" @handleAddSub="handleSubAdd" ></Workorderbom>
</el-tab-pane>
<el-tab-pane label="物料需求">
<Workorderbom
ref="bomlist"
:optType="optType"
:workorder="form"
@handleAddSub="handleSubAdd"
></Workorderbom>
</el-tab-pane>
<el-tab-pane label="物料需求"> </el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button>
<el-button type="success" @click="handleConfirm" v-if="form.status =='PREPARE' && optType !='view' && form.workorderId !=null"> </el-button>
<el-button
type="primary"
@click="cancel"
v-if="optType == 'view' || form.status != 'PREPARE'"
>返回</el-button
>
<el-button
type="primary"
@click="submitForm"
v-if="form.status == 'PREPARE' && optType != 'view'"
> </el-button
>
<el-button
type="success"
@click="handleConfirm"
v-if="
form.status == 'PREPARE' &&
optType != 'view' &&
form.workorderId != null
"
> </el-button
>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -407,26 +603,33 @@
</template>
<script>
import { listWorkorder, getWorkorder, delWorkorder, addWorkorder, updateWorkorder ,dofinish} from "@/api/mes/pro/workorder";
import {
listWorkorder,
getWorkorder,
delWorkorder,
addWorkorder,
updateWorkorder,
dofinish,
} from "@/api/mes/pro/workorder";
import Workorderbom from "./bom/bom.vue";
import WorkorderItemList from "./items/item.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import ClientSelect from "@/components/clientSelect/single.vue";
import VendorSelect from "@/components/vendorSelect/single.vue";
import {genCode} from "@/api/system/autocode/rule"
import { genCode } from "@/api/system/autocode/rule";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Workorder",
dicts: ['mes_order_status','mes_workorder_sourcetype','mes_workorder_type'],
dicts: ["mes_order_status", "mes_workorder_sourcetype", "mes_workorder_type"],
components: {
Treeselect,
ItemSelect,
ClientSelect,
VendorSelect,
Workorderbom,
WorkorderItemList
WorkorderItemList,
},
data() {
return {
@ -481,33 +684,33 @@ export default {
//
rules: {
workorderCode: [
{ required: true, message: "工单编码不能为空", trigger: "blur" }
{ required: true, message: "工单编码不能为空", trigger: "blur" },
],
workorderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" }
{ required: true, message: "工单名称不能为空", trigger: "blur" },
],
// workorderType: [
// { required: true, message: "", trigger: "blur" }
// ],
orderSource: [
{ required: true, message: "来源类型不能为空", trigger: "blur" }
{ required: true, message: "来源类型不能为空", trigger: "blur" },
],
productId: [
{ required: true, message: "产品不能为空", trigger: "blur" }
{ required: true, message: "产品不能为空", trigger: "blur" },
],
productCode: [
{ required: true, message: "产品编号不能为空", trigger: "blur" }
{ required: true, message: "产品编号不能为空", trigger: "blur" },
],
productName: [
{ required: true, message: "产品名称不能为空", trigger: "blur" }
{ required: true, message: "产品名称不能为空", trigger: "blur" },
],
quantity: [
{ required: true, message: "生产数量不能为空", trigger: "blur" }
{ required: true, message: "生产数量不能为空", trigger: "blur" },
],
requestDate: [
{ required: true, message: "需求日期不能为空", trigger: "blur" }
{ required: true, message: "需求日期不能为空", trigger: "blur" },
],
}
},
};
},
created() {
@ -517,8 +720,12 @@ export default {
/** 查询生产工单列表 */
getList() {
this.loading = true;
listWorkorder(this.queryParams).then(response => {
this.workorderList = this.handleTree(response.rows, "workorderId", "parentId");
listWorkorder(this.queryParams).then((response) => {
this.workorderList = this.handleTree(
response.rows,
"workorderId",
"parentId"
);
this.total = response.total;
this.loading = false;
});
@ -531,15 +738,23 @@ export default {
return {
id: node.workorderId,
label: node.workorderName,
children: node.children
children: node.children,
};
},
/** 查询生产工单下拉树结构 */
getTreeselect() {
listWorkorder().then(response => {
listWorkorder().then((response) => {
this.workorderOptions = [];
const data = { workorderId: 0, workorderName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "workorderId", "parentId");
const data = {
workorderId: 0,
workorderName: "顶级节点",
children: [],
};
data.children = this.handleTree(
response.data,
"workorderId",
"parentId"
);
this.workorderOptions.push(data);
});
},
@ -554,7 +769,7 @@ export default {
workorderId: null,
workorderCode: null,
workorderName: null,
workorderType: 'SELF',
workorderType: "SELF",
orderSource: null,
sourceCode: null,
productId: null,
@ -579,7 +794,8 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
workpieceType: "1",
};
this.autoGenFlag = true;
this.resetForm("form");
@ -627,7 +843,7 @@ export default {
this.open = true;
this.title = "添加生产工单";
this.optType = "add";
genCode('WORKORDER_CODE').then(response =>{
genCode("WORKORDER_CODE").then((response) => {
this.form.workorderCode = response;
});
},
@ -636,7 +852,7 @@ export default {
this.reset();
this.getTreeselect();
const workorderId = row.workorderId || this.ids;
getWorkorder(workorderId).then(response => {
getWorkorder(workorderId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "查看工单信息";
@ -650,9 +866,9 @@ export default {
if (row != null) {
this.form.parentId = row.workorderId;
}
getWorkorder(row.workorderId).then(response => {
getWorkorder(row.workorderId).then((response) => {
this.form = response.data;
this.form.workorderType = 'SELF'
this.form.workorderType = "SELF";
this.open = true;
this.title = "修改生产工单";
this.optType = "edit";
@ -660,17 +876,17 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.workorderId != null) {
updateWorkorder(this.form).then(response => {
updateWorkorder(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
//this.open = false;
this.$refs["bomlist"].getList();
this.getList();
});
} else {
addWorkorder(this.form).then(response => {
addWorkorder(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
//this.open = false;
this.form.workorderId = response.data;
@ -682,12 +898,18 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除生产工单编号为"' + row.workorderId + '"的数据项?').then(function() {
this.$modal
.confirm(
'是否确认删除生产工单编码为"' + row.workorderCode + '"的数据项?'
)
.then(function () {
return delWorkorder(row.workorderId);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
})
.catch(() => {});
},
handleSelectProduct() {
this.$refs.itemSelect.showFlag = true;
@ -697,25 +919,35 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/pro/workorder/export', {
...this.queryParams
}, `workorder_${new Date().getTime()}.xlsx`)
this.download(
"mes/pro/workorder/export",
{
...this.queryParams,
},
`workorder_${new Date().getTime()}.xlsx`
);
},
handleConfirm() {
let that = this;
this.$modal.confirm('是否确认完成工单编制?【确认后将不能更改】').then(function(){
that.form.status = 'CONFIRMED';
this.$modal
.confirm("是否确认完成工单编制?【确认后将不能更改】")
.then(function () {
that.form.status = "PRODUCTION";
that.submitForm();
});
},
handleFinish(row) {
const workorderIds = row.workorderId || this.ids;
this.$modal.confirm('确认完成工单?一旦完成,此工单将无法继续报工').then(function() {
return dofinish(workorderIds) //
}).then(() => {
this.$modal
.confirm("确认完成工单?一旦完成,此工单将无法继续报工")
.then(function () {
return dofinish(workorderIds); //
})
.then(() => {
this.getList();
this.$modal.msgSuccess("更改成功");
}).catch(() => {});
})
.catch(() => {});
},
//
onItemSelected(obj) {
@ -751,13 +983,13 @@ export default {
//
handleAutoGenChange(autoGenFlag) {
if (autoGenFlag) {
genCode('WORKORDER_CODE').then(response =>{
genCode("WORKORDER_CODE").then((response) => {
this.form.workorderCode = response;
});
} else {
this.form.workorderCode = null;
}
}
}
},
},
};
</script>