|
|
@@ -0,0 +1,480 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container space">
|
|
|
+ <el-row :gutter="12">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-card shadow="always">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <span>产线运行记录</span>
|
|
|
+
|
|
|
+ <el-radio v-model="exeStatus" label="1">全部</el-radio>
|
|
|
+ <el-radio v-model="exeStatus" label="0">执行中</el-radio>
|
|
|
+
|
|
|
+ <el-button type="primary" size="mini" @click="getLog()">刷新</el-button>
|
|
|
+ </div>
|
|
|
+ <!-- 列表数据 -->
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData.records"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ row-key="id"
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <el-table-column prop="orderName" label='订单名称' width="160px" show-overflow-tooltip> </el-table-column>
|
|
|
+ <el-table-column prop="completeBatchNo" label='同一零件批次' width="140px" show-overflow-tooltip> </el-table-column>
|
|
|
+ <el-table-column prop="uniqueCode" label='零件编码' width="140px" show-overflow-tooltip> </el-table-column>
|
|
|
+ <el-table-column prop="taskNodeName" label='任务名称' width="180px"> </el-table-column>
|
|
|
+ <el-table-column prop="startStorge" label='开始点位' width="180px"> </el-table-column>
|
|
|
+ <el-table-column prop="endStorge" label='结束点位' width="180px"></el-table-column>
|
|
|
+ <el-table-column prop="executeTime" label='执行时间' width="160px"></el-table-column>
|
|
|
+ <el-table-column prop="exeStatus" label='执行状态' width="80px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.exeStatus == '1'" type="info">待执行</el-tag>
|
|
|
+ <el-tag v-if="row.exeStatus == '2'" type="primary">执行中</el-tag>
|
|
|
+ <el-tag v-else type="success">已完成</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="sendStatus" label='是否下发' width="80px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.sendStatus == '0'" type="info">未下发</el-tag>
|
|
|
+ <el-tag v-if="row.sendStatus == '1'" type="primary">已下发</el-tag>
|
|
|
+ <el-tag v-if="row.sendStatus == '2'" type="success">已返回</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="exeResult" label='执行结果' width="80px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.exeResult == '1'" type="success">成功</el-tag>
|
|
|
+ <el-tag v-if="row.exeResult == '0'" type="danger">失败</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="feedback" label='运行时信息' width="160px" show-tooltip-when-overflow></el-table-column>
|
|
|
+ <el-table-column prop="callBack" label='回调信息' width="160px" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ fixed="right"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="210px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button v-if="(row.taskNodeName ==='人工上料' || row.taskNodeName ==='人工下料') && row.exeStatus === '2' && row.sendStatus == 0" size="mini" type="info" >需要人工操作物料</el-button>
|
|
|
+ <el-button v-if="row.taskNodeName !='人工上料' && row.taskNodeName !='人工下料' && row.exeStatus === '2' && row.sendStatus == 0" size="mini" type="danger" @click="resendCommand(row)">指令重发</el-button>
|
|
|
+ <!-- <el-button v-if="row.exeStatus === '1'" type="primary" size="mini" @click="cancelTaskNodeLog(row)">取消任务</el-button> -->
|
|
|
+ <el-button v-if="(row.exeStatus === '2' && row.sendStatus == 1 && row.exeResult != 1) || (row.exeStatus === '2' && row.sendStatus == 2 && row.exeResult != 1)" type="warning" size="mini" @click="taskNodeCallback(row)">模拟回调</el-button>
|
|
|
+
|
|
|
+ <el-tooltip
|
|
|
+ class="item"
|
|
|
+ content="解锁库位"
|
|
|
+ effect="dark"
|
|
|
+ placement="top-start"
|
|
|
+ v-if="row.exeStatus === '4'"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-unlock table-operation"
|
|
|
+ style="color: #2db7f5"
|
|
|
+ @click="unlock(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip
|
|
|
+ class="item"
|
|
|
+ content="执行下一个节点"
|
|
|
+ effect="dark"
|
|
|
+ placement="top-start"
|
|
|
+ v-if="row.exeStatus === '4'"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-caret-bottom table-operation"
|
|
|
+ style="color: #2db7f5"
|
|
|
+ @click="executeNextNode(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="tableData.total > 0"
|
|
|
+ :limit.sync="queryParams.size"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
+ :total="Number(tableData.total)"
|
|
|
+ @pagination="fetch"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="提示"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="30%"
|
|
|
+ :before-close="handleClose">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="unlockStorge(0)">解除库位锁</el-button>
|
|
|
+ <el-button type="primary" @click="unlockStorge(1)">解除库位锁并移库</el-button>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ title="节点信息"
|
|
|
+ :visible.sync="visible"
|
|
|
+ width="60%">
|
|
|
+ <el-table
|
|
|
+ ref="table"
|
|
|
+ :data="taskNodeList"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ row-key="id"
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <el-table-column prop="orderName" label='订单名称' width="120px"> </el-table-column>
|
|
|
+ <el-table-column prop="bomName" label='零件名称' width="120px"> </el-table-column>
|
|
|
+ <el-table-column prop="nodeName" label='节点名称' width="160px"> </el-table-column>
|
|
|
+ <el-table-column prop="exeStatus" label='执行状态' width="100px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.exeStatus == '1'" type="info">待执行</el-tag>
|
|
|
+ <el-tag v-else-if="row.exeStatus == '2'" type="success">执行中</el-tag>
|
|
|
+ <el-tag v-else-if="row.exeStatus == '3'" type="success">已完成</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="exeResult" label='执行结果' width="100px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.exeResult == '1'" >成功</el-tag>
|
|
|
+ <el-tag v-if="row.exeResult == '0'" >失败</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="startTime" label='开始时间' width="160px"></el-table-column>
|
|
|
+ <el-table-column prop="endTime" label='结束时间' width="160px"></el-table-column>
|
|
|
+ <el-table-column prop="targetResourceName" label='目标设备' width="120px"></el-table-column>
|
|
|
+ <el-table-column prop="resourceName" label='操作设备' width="120px"></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import dispatchMgrApi from "@/api/Dispatch";
|
|
|
+import Pagination from "@/components/Pagination/index.vue";
|
|
|
+import {initQueryParams} from "@/utils/commons";
|
|
|
+export default {
|
|
|
+ name: "productLineInfo",
|
|
|
+ components: {Pagination},
|
|
|
+ data() {
|
|
|
+ return{
|
|
|
+ list: {},
|
|
|
+ plcInfo: {},
|
|
|
+ pcInfo: {},
|
|
|
+ point: '',
|
|
|
+ loading: false,
|
|
|
+ tableData: {
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ queryParams: initQueryParams({}),
|
|
|
+ dialogVisible: false,
|
|
|
+ id: '',
|
|
|
+ exeStatus:'1',
|
|
|
+ visible: false,
|
|
|
+ taskNodeList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.fetch();
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ executeNextNode(row){
|
|
|
+ this.loading = true;
|
|
|
+ this.$confirm("是否确认跳过当前节点执行下一个节点【如需移库,必须先完成移库】", this.$t('common.tips'), {
|
|
|
+ confirmButtonText: this.$t('common.confirm'),
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ //查询PLC点位信息
|
|
|
+ dispatchMgrApi.executeNextNode(row.id).then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ this.loading = false;
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.$message({
|
|
|
+ message:'执行成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getLog();
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message:'执行失败:' + res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(e=>{
|
|
|
+ this.loading = false;
|
|
|
+ this.$message({
|
|
|
+ message:'执行失败:' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.info("已取消")
|
|
|
+ })
|
|
|
+ },
|
|
|
+ cancelTaskNodeLog(row){
|
|
|
+ this.loading = true;
|
|
|
+ this.$confirm("是否确认取消", this.$t('common.tips'), {
|
|
|
+ confirmButtonText: this.$t('common.confirm'),
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ //查询PLC点位信息
|
|
|
+ dispatchMgrApi.cancelTaskNodeLog(row.id).then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ this.loading = false;
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.$message({
|
|
|
+ message:'取消指令成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getLog();
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message:'取消指令失败:' + res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(e=>{
|
|
|
+ this.loading = false;
|
|
|
+ this.$message({
|
|
|
+ message:'取消指令失败:' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }).finally(() => this.getLog())
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.info("已取消")
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 模拟ccs 设备回调
|
|
|
+ taskNodeCallback(row){
|
|
|
+ var params = {}
|
|
|
+ params.code = '1'
|
|
|
+ params.taskId = row.taskId
|
|
|
+ params.taskNodeId = row.taskNodeId
|
|
|
+
|
|
|
+ this.loading = true;
|
|
|
+ this.$confirm("是否确认模拟回调", this.$t('common.tips'), {
|
|
|
+ confirmButtonText: this.$t('common.confirm'),
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ //模拟回调接口
|
|
|
+ dispatchMgrApi.taskNodeCallback(params).then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ this.loading = false;
|
|
|
+ console.log(response)
|
|
|
+ if(res.isSuccess){
|
|
|
+ // 延迟两秒执行查询功能,因为模拟回调后,下一个任务会进入mq进行执行,所以执行数据会出现几毫秒的延迟,如果立马刷新,会导致数据查询不到
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$message({
|
|
|
+ message:'模拟回调成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getLog();
|
|
|
+ }, 2000);
|
|
|
+ }else{
|
|
|
+ this.getLog();
|
|
|
+ this.$message({
|
|
|
+ message:'模拟回调失败:' + res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(e=>{
|
|
|
+ this.loading = false;
|
|
|
+ this.getLog();
|
|
|
+ this.$message({
|
|
|
+ message:'错误:' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.info("已取消")
|
|
|
+ })
|
|
|
+ },
|
|
|
+ unlock(row){
|
|
|
+ this.id = row.id
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ unlockStorge(moveFlag){
|
|
|
+ this.loading = true;
|
|
|
+ this.$confirm("是否确认执行此操作", this.$t('common.tips'), {
|
|
|
+ confirmButtonText: this.$t('common.confirm'),
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ //查询PLC点位信息
|
|
|
+ dispatchMgrApi.unlockStorge(this.id,moveFlag).then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ this.loading = false;
|
|
|
+ this.id = ''
|
|
|
+ this.dialogVisible = false
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.$message({
|
|
|
+ message:'取消指令成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getLog();
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message:'取消指令失败:' + res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }).catch(e=>{
|
|
|
+ this.loading = false;
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.id = ''
|
|
|
+ this.$message({
|
|
|
+ message:'取消指令失败:' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.info("已取消")
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleClose(){
|
|
|
+ this.id = '';
|
|
|
+ this.dialogVisible = false
|
|
|
+
|
|
|
+ },
|
|
|
+ fetch(){
|
|
|
+ //查询日志
|
|
|
+ this.getLog();
|
|
|
+ //查询PLC点位信息
|
|
|
+ //this.getPlcInfo();
|
|
|
+ },
|
|
|
+ //指令重发
|
|
|
+ resendCommand(row){
|
|
|
+ this.loading = true;
|
|
|
+ this.$confirm("重发指令前请确认好准备工作,如已准备好,点击确认按钮", this.$t('common.tips'), {
|
|
|
+ confirmButtonText: this.$t('common.confirm'),
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ //查询PLC点位信息
|
|
|
+ dispatchMgrApi.resendCommand(row.id).then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ this.loading = false;
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.$message({
|
|
|
+ message:'指令重发成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message:'指令重发失败:' + res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(e=>{
|
|
|
+ this.loading = false;
|
|
|
+ this.$message({
|
|
|
+ message:'指令重发失败:' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.info("已取消")
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ getLog(params = {}){
|
|
|
+ this.loading = true
|
|
|
+ this.queryParams.current = params.current ? params.current : this.queryParams.current
|
|
|
+ this.queryParams.size = params.size ? params.size : this.queryParams.size
|
|
|
+ this.queryParams.model.exeStatus = this.exeStatus=='1'? '' : '2'
|
|
|
+ dispatchMgrApi.selectLogs(this.queryParams).then((response) => {
|
|
|
+ const res = response.data;
|
|
|
+ this.loading = false
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.tableData = res.data
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message:'查询失败',
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getPlcInfo(){
|
|
|
+ //查询PLC点位信息
|
|
|
+ dispatchMgrApi.getPointInfo().then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.pcInfo = res.data['pcToPlcMap'];
|
|
|
+ this.plcInfo = res.data['plcToPcMap']
|
|
|
+ this.$message({
|
|
|
+ message:'成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(e=>{
|
|
|
+ this.$message({
|
|
|
+ message:'查询失败' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ clearAll(){
|
|
|
+ //一键清零
|
|
|
+ this.clearPlcPoint('1');
|
|
|
+ },
|
|
|
+ clearOne(){
|
|
|
+ if(!this.point){
|
|
|
+ this.$message.error("请输入要清零的地址")
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //单点清零
|
|
|
+ this.clearPlcPoint('2');
|
|
|
+ },
|
|
|
+ clearPlcPoint(flag){
|
|
|
+ this.$confirm('确认清除PLC地址位数据嘛?请谨慎考虑', this.$t("common.tips"), {
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ //清除PLC点位
|
|
|
+ dispatchMgrApi.clearPlcPoint(this.point,flag).then((response)=>{
|
|
|
+ const res = response.data;
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.$message({
|
|
|
+ message:'成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.getPlcInfo();
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message:'清除失败' + res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch(e=>{
|
|
|
+ this.$message({
|
|
|
+ message:'清除失败' + e.message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.card_content {
|
|
|
+ padding: 8px;
|
|
|
+ width: 100%;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+.el-form-item {
|
|
|
+ margin-bottom: 0;
|
|
|
+}
|
|
|
+</style>
|