Browse Source

上下料站关联文件

oyq28 2 years ago
parent
commit
a60730af7d

+ 386 - 0
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View5.vue

@@ -0,0 +1,386 @@
+<template>
+    <el-dialog
+      :title='$t("common.view")'
+      width="80%"
+      :append-to-body="true"
+      :visible.sync="isVisible"
+      class="tenant-view"
+    >
+      <div class="boxDiv">
+          <!-- 任务信息 -->
+          <el-steps :active="active" finish-status="success" simple style="margin:20px 0;">
+                    <el-step title="确认工装" ></el-step>
+                    <el-step title="装夹物料" ></el-step>
+          </el-steps>
+  
+          <el-row v-show="this.active==1">
+              <p style="margin-top:0;text-align:center;font-size:18px;">{{$t("runCenter.form.viewSched.name")}}
+                  <span style="float:right;margin-right:20px;font-size:14px;">{{$t("runCenter.form.viewSched.bomNo")+":"}}{{tenant.no}}</span>
+              </p>
+              <table class="comtable" border="0" cellspacing="0" cellpadding="6">
+                  <tr>
+                      <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.procedureNo")+":"}}</td>
+                      <td width="200">{{tenant.taskNo}}</td>
+                      <td class="blodTd" align="center" width="120">{{$t("runCenter.form.viewSched.status")+":"}}</td>
+                      <td width="120">
+                           <el-tag v-if="tenant.status == 0" type="info">{{$t("runCenter.common.schedulStatus.noStart")}}</el-tag>
+                              <el-tag v-if="tenant.status == 1" type="">{{$t("runCenter.common.schedulStatus.run")}}</el-tag>
+                              <el-tag v-if="tenant.status == 2" type="success">{{$t("runCenter.common.schedulStatus.finished")}}</el-tag>
+                      </td>
+                  </tr>
+                  <tr>
+                      <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedureDesc")+":"}}</td>
+                      <td>{{tenant.taskName}}</td>
+                      <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.content")+":"}}</td>
+                      <td width="200">{{tenant.content}}</td>
+                  </tr>
+                  <tr>
+                      <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.prepareWorkHours")+":"}}</td>
+                      <td>{{tenant.time}}分钟</td>
+                      <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.procedurePosition")+":"}}</td>
+                      <td>{{tenant.currentStationName}}</td>
+                  </tr>
+                  <tr>
+                      <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
+                      <td>{{tenant.startTime}}</td>
+                      <td class="blodTd" align="center">{{$t("runCenter.form.viewSched.endTime")+":"}}</td>
+                      <td>{{tenant.endTime}}</td>
+                  </tr>
+              </table>
+          </el-row>
+  
+          <!-- 安装夹具 -->
+          <el-row v-show="this.active==1">
+              <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >ST1: 请安装夹具 <span style="color:red;margin-left:5px;font-size:14px;"></span></p>
+              <p v-if="!tableData.records"  class="titleP"    style="margin-top:15px;color:#000;font-size:14px;white-space:pre;" >呼叫托盘工装   <el-button size="medium" type="primary" :disabled="confirmDisabled" @click="callRobot" round>呼叫托盘工装</el-button></p>
+              <!-- Table数据 -->
+              <el-table
+                ref="table"
+                v-loading="loading"
+                :data="tableData.records"
+                border
+                fit
+                style="width: 100%;"
+              >
+                <!-- 编号 -->
+                <el-table-column prop="no" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
+                 <!-- 编号 -->
+                <el-table-column prop="type" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
+                <!-- 名称 -->
+                <el-table-column prop="name" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
+  
+              </el-table>
+          </el-row>
+  
+          <!-- 装夹物料 -->
+          <el-row v-show="this.active>1">
+              <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >ST2: 装夹物料</p>
+              <!-- Table数据 -->
+              <el-table
+                ref="table1"
+                v-loading="loading"
+                :data="tableData1.records"
+                border
+                fit
+                style="width: 100%;"
+              >
+                <!-- 材料编码 -->
+                <el-table-column prop="meterialCode" :label='$t("prepare.table.tools.no")' align="center" ></el-table-column>
+                 <!-- 材料牌号 -->
+                <el-table-column prop="tradeMark" :label='$t("prepare.table.tools.type")' align="center" ></el-table-column>
+                <!-- 材料名称 -->
+                <el-table-column prop="equipmentName" :label='$t("prepare.table.tools.name")' align="center"></el-table-column>
+                <!-- 装夹方式 -->
+                <el-table-column prop="clampImg" :label='$t("prepare.table.tools.clampImg")' align="center">
+                      <template slot-scope="{ row }">
+                           <div class="block">
+                               <el-image
+                                    style="width: 60px; height: 60px"
+                                    :src="row.armorPic"
+                                    fit="fill"></el-image>
+                           </div>
+                      </template>
+                </el-table-column>
+              </el-table>
+          </el-row>
+  
+          <!-- 输入唯一码 -->
+          <el-row v-show="this.active>1">
+            <p class="titleP" style="margin-top:15px;color:#000;font-size:18px;" >输入零件编码  
+            <el-button size="small" type="primary" @click.native="confirmCode" round>扫码确认</el-button> </p>
+            <el-input v-model="uniqueCode" placeholder="输入零件编码"></el-input>
+  
+          </el-row>
+  
+          <div slot="footer" class="dialog-footer">
+            <el-button plain type="info" @click.native="prev" v-show="this.active>1"  >返回上一步</el-button>
+            <el-button type="primary" :disabled="confirmDisabled" @click.native="next" v-show="this.active==1">已完成,下一步</el-button>
+            <el-button type="primary" :disabled="confirmDisabled" @click.native="submitForm" v-show="this.active>1">上料完成</el-button>
+          </div>
+      </div>
+    </el-dialog>
+  </template>
+  <script>
+      // 【分页】组件
+    import taskMgrApi from "@/api/runManageCenter/taskMgr";
+    import machiningClientApi from "@/api/machiningClient/machiningClient"
+      // 列表查询的共通参数
+      import { initQueryParams } from '@/utils/commons'
+  export default {
+    name: 'TaskView',
+    components: { },
+    props: {
+      dialogVisible: {
+        type: Boolean,
+        default: false
+      }
+    },
+    data () {
+      return {
+        active: 1,
+        screenWidth: 0,
+        confirmDisabled: false,	  
+        width: this.initWidth(),
+        tenant: {},
+        queryParams: initQueryParams({}),
+        RFIDParams: {
+          url: "192.168.11.130",
+          port: "102",
+          taskId: "",
+            taskNodeId: "",
+            data: {
+              content: "",
+              positionIndex: ""
+            }
+        },
+        loading: false,
+          uniqueCode: '',
+          isReload: 0,
+          tenantViewVisible: false,
+          callRobotFlag:false,
+          tableKey: 0,
+            tableData: {
+              total: 0
+            },
+            tableData1: {
+             total: 0
+          },
+            tableData2: [],
+            currentRow: null, // 当前选择的行
+          currentIndex: 0,  //上下料站默认序号
+            spanArr: [],  // 【组序】合并单元格
+          spanArr2: [],  // 【优先级】合并单元格
+      }
+    },
+    // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+    created() {
+      },
+    computed: {
+      isVisible: {
+        get () {
+          return this.dialogVisible
+        },
+        set () {
+          this.close()
+        }
+      }
+    },
+    mounted () {
+      window.onresize = () => {
+        return (() => {
+          this.width = this.initWidth()
+        })()
+      }
+    },
+    methods: {
+      prev(){
+        if (this.active-- < 0) this.active = 0;
+      },
+      next(){
+          // TODO 写入rfid内容(子盘信息和夹具信息)
+        taskMgrApi.procesRfid({ "id" : this.tenant.id, "clampId" : this.tenant.clampId,rfidType: "write" }).then((res) => {
+          res = res.data;          
+        });
+        if (this.active++ > 1) this.active = 0; 
+        
+      },
+      callRobot(){
+        this.callRobotFlag = true
+        machiningClientApi.callRobot({ "taskNodeId" : this.tenant.taskNodeId}).then((res) => {
+        res = res.data;
+        if (res.isSuccess) {
+          // 通知列表
+          this.$emit("success");
+          // // 通知列表-并关闭弹出框
+          // this.$emit("close");
+        }
+      }).finally(()=>{
+        this.callRobotFlag = false
+      });
+    },
+      confirmCode(){
+          let valid = this.uniqueCode!=''? true: false;
+          if(!valid){
+            this.$message({
+                message: "零件编码" + this.$t("rules.require"),
+                type: "warning"
+            })
+            this.confirmDisabled = false
+            return false
+          }
+          taskMgrApi.confirmCode({ "uniqueCode" : this.uniqueCode, "orderId":this.tenant.orderId}).then((res) => {
+            res = res.data;
+            if (res.isSuccess) {            
+              this.confirmDisabled = false
+            }
+          });       
+          this.confirmDisabled = true
+        },
+        submitForm(){
+        // 更新改任务的开始时间
+        // TODO 写入rfid内容,工件信息、原材料R
+          this.confirmDisabled = true
+        let valid = this.uniqueCode!=''? true: false;
+          if(!valid){
+            this.$message({
+                message: "零件编码" + this.$t("rules.require"),
+                type: "warning"
+            })
+            this.confirmDisabled = false
+            return false
+          }
+          //this.$confirm('确认?')		
+          let that = this
+          this.$confirm(
+          '确定上料已完成并且舱门已关闭?',
+          this.$t("common.tips"),
+          {
+            distinguishCancelAndClose: true,
+            confirmButtonText: this.$t("common.confirm"),
+            cancelButtonText: this.$t("common.cancel"),
+            type: "warning",
+          }).then(() => {
+              //上料处理
+              this.addMaterial(that)
+          }).catch(()=>{})
+        },
+      addMaterial(that){		
+          taskMgrApi.updateTaskStatus({ "id" : that.tenant.id,"meterialId":that.tenant.meterialId, "uniqueCode":that.uniqueCode, "taskNodeId": that.tenant.taskNodeId, "updateType" : "end", "processType" : "5", "updateUser" : that.$store.state.account.user.id, "positionIndex": that.currentIndex}).then((res) => {
+            res = res.data;
+            if (res.isSuccess) {
+                //写入RFID
+                that.RFIDParams.taskId = that.tenant.id
+                that.RFIDParams.taskNodeId = that.tenant.taskNodeId
+                that.RFIDParams.data.positionIndex = that.currentIndex
+                //写入空值
+                machiningClientApi.write(that.RFIDParams).then(res2 => {				 
+                   if(res2.data.result){
+                      console.log("空值写入成功")	
+                   }
+                });
+                that.RFIDParams.data.content = that.uniqueCode
+                //写入新值
+                machiningClientApi.write(that.RFIDParams).then(res2 => {
+                  if(res2.data.result){
+                      console.log("rfid写入成功")		
+                  }
+                  setTimeout(function(){
+                      //通知列表
+                    that.$emit("success");
+                    //通知列表-并关闭弹出框
+                    that.$emit("close");
+                   }, 1000);
+                    
+                });                
+            }
+        }).finally(()=>{
+            that.confirmDisabled = false
+        });
+      },
+        // table的当前行值变化后
+        handleCurrentChange(val) {
+              // 设置当前行
+          this.currentRow = val;
+        },
+      initWidth () {
+        this.screenWidth = document.body.clientWidth
+        if (this.screenWidth < 550) {
+          return '95%'
+        } else if (this.screenWidth < 990) {
+          return '580px'
+        } else if (this.screenWidth < 1400) {
+          return '600px'
+        } else {
+          return '650px'
+        }
+      },
+      setTenant (val) {
+        this.tenant = { ...val }
+        console.log(this.tenant)
+        this.currentIndex = this.tenant.currentStationName.substr(-1)
+        // 添加数据
+        this.tableData.records = []
+        // 添加数据
+        this.tableData.records.push({
+            no: this.tenant.clampNo,
+            name: this.tenant.clampName
+        })
+  
+        this.tableData1.records = []
+        // 添加数据
+        this.tableData1.records.push({
+            meterialCode: this.tenant.meterialCode,
+            equipmentName: this.tenant.equipmentName,
+            tradeMark: this.tenant.tradeMark,
+            armorPic: this.tenant.armorPic,
+        })	  
+  
+        // 更新改任务的开始时间
+        taskMgrApi.updateTaskStatus({ "id" : this.tenant.id,  "updateType" : "begin", "taskNodeId": this.tenant.taskNodeId, "positionIndex": this.currentIndex}).then((res) => {
+          res = res.data;
+          if (res.isSuccess) {
+            console.log("update task startTime success");
+          }
+        });
+  
+      },
+      close () {
+        this.$emit('close')
+      }      
+    }
+  }
+  </script>
+  <style lang="scss" scoped>
+      .dialog-footer{
+          text-align: center;
+          padding: 30px;
+      }
+      .titleP{
+          position: relative;
+          font-size: 16px;
+          padding-left: 15px;
+      }
+      .titleP:before{
+          content: '';
+          position: absolute;
+          left: 0;
+          top: 3px;
+          width: 5px;
+          height: 80%;
+          background: #0F79DC;
+      }
+      .comtable{
+          width: 100%;
+          border-left: 1px solid #CCCCCC;
+          border-top: 1px solid #CCCCCC;
+      }
+      .comtable td{
+          border-right: 1px solid #CCCCCC;
+          border-bottom: 1px solid #CCCCCC;
+      }
+      .blodTd{
+          background: #EEEEEE;
+          color: #333333;
+      }
+  </style>
+