Jelajahi Sumber

工控端修改优化

yejian016332 3 tahun lalu
induk
melakukan
94dd7fecc6

+ 259 - 235
imcs-ui/src/api/runManageCenter/taskMgr.js

@@ -1,235 +1,259 @@
-/*********************** 【任务管理】API ********************/
-import axiosApi from '../AxiosApi.js'
-
-const apiList = {
-	getList: {
-	    method: 'POST',
-	    url: `/authority/task/all`
-	  },
-  	page: {
-	    method: 'POST',
-	    url: `/authority/task/page`
-  	},
-	update: {
-	    method: 'POST',
-	    url: `/authority/task/update`
-	},
-  	save: {
-    	method: 'POST',
-    	url: `/authority/task`
-  	},
-	updateStatus: {
-	    method: 'POST',
-	    url: `/authority/task/status`
-	},
-  	remove: {
-    	method: 'DELETE',
-    	url: `/authority/task`
-  	},
-  	delete: {
-    	method: 'POST',
-    	url: `/authority/task/delete`
-  	},
-	// 任务-甘特图 (月模式)
-	scheduleTaskpageList: {
-	    method: 'POST',
-	    url: `/authority/task/scheduleTaskpageList`
-	},
-	// 任务-甘特图 (日模式)
-	scheduleTaskDaypageList: {
-	    method: 'POST',
-	    url: `/authority/task/scheduleTaskDaypageList`
-	},
-  	// 任务,头上统计数据API
-  	getTaskCount: {
-    	method: 'POST',
-    	url: `/authority/task/getTaskCount`
-  	},
-  	list: {
-    	method: 'POST',
-    	url: `/authority/task/query`
-  	},
-  	preview: {
-    	method: 'POST',
-    	url: `/authority/task/preview`
-  	},
-
-  	// 根据生产资源获取当前执行任务信息
-  	getTaskByResourceId: {
-    	method: 'POST',
-    	url: `/authority/task/getTaskByResourceId`
-  	},
-
-  	// 检测当前设备是否有正在执行的任务
-  	checkExeTask: {
-    	method: 'POST',
-    	url: `/authority/task/checkExeTask`
-  	},
-
-  	// 查询生产资源上的任务节点
-  	taskAutoNodeListByResource: {
-    	method: 'POST',
-    	url: `/authority/autoNode/taskAutoNodeListByResource`
-  	},
-
-  	export: {
-    	method: 'POST',
-    	url: `/authority/task/export`
-  	},
-  	import: {
-    	method: 'POST',
-    	url: `/authority/task/import`
-  	},
-    getStationTasks: {
-      method: 'POST',
-      url: `/authority/task/getStationTasks`
-    },
-  updateTaskStatus: {
-      method: 'POST',
-      url: `/authority/task/updateTaskStatus`
-    }
-}
-
-export default {
-	getList (data) {
-    return axiosApi({
-      ...apiList.getList,
-      data
-    })
-  },
-  page (data) {
-    return axiosApi({
-      ...apiList.page,
-      data
-    })
-  },
-  save (data) {
-    return axiosApi({
-      ...apiList.save,
-      data
-    })
-  },
-  update (data) {
-    return axiosApi({
-      ...apiList.update,
-      data
-    })
-  },
-  updateStatus (data) {
-    return axiosApi({
-      ...apiList.updateStatus,
-      data
-    })
-  },
-  remove (data) {
-    return axiosApi({
-      ...apiList.remove,
-      data
-    })
-  },
-  // 任务-甘特图
-  scheduleTaskpageList (data) {
-    return axiosApi({
-      ...apiList.scheduleTaskpageList,
-      data
-    })
-  },
-  // 任务-甘特图
-  scheduleTaskDaypageList (data) {
-    return axiosApi({
-      ...apiList.scheduleTaskDaypageList,
-      data
-    })
-  },
-  delete (data) {
-    return axiosApi({
-      ...apiList.remove,
-      data
-    })
-  },
-  getTaskCount (data) {
-    return axiosApi({
-      ...apiList.getTaskCount,
-      data
-    })
-  },
-  list (data) {
-    return axiosApi({
-      ...apiList.list,
-      data
-    })
-  },
-  check (code) {
-    return axiosApi({
-      method: 'GET',
-      url: `/authority/task/check/${code}`
-    })
-  },
-
-  	// 根据生产资源获取当前执行任务信息
-  	getTaskByResourceId (data) {
-	    return axiosApi({
-	      	...apiList.getTaskByResourceId,
-	      	data
-	    })
-  	},
-
-  	// 检测当前设备是否有正在执行的任务
-  	checkExeTask (data) {
-	    return axiosApi({
-	      	...apiList.checkExeTask,
-	      	data
-	    })
-  	},
-
-  	// 查询生产资源上的任务节点
-  	taskAutoNodeListByResource (data) {
-	    return axiosApi({
-	      	...apiList.taskAutoNodeListByResource,
-	      	data
-	    })
-  	},
-
-
-  checkField (data) {
-    return axiosApi({
-      method: 'POST',
-      url: `/authority/task/check`,
-      data
-    })
-  },
-  preview (data) {
-    return axiosApi({
-      ...apiList.preview,
-      data
-    })
-  },
-  export (data) {
-    return axiosApi({
-      ...apiList.export,
-      responseType: "blob",
-      data
-    })
-  },
-  import (data) {
-    return axiosApi({
-      ...apiList.import,
-      data
-    })
-  },
-  // 查询生产资源上的任务节点
-  getStationTasks (data) {
-    return axiosApi({
-      ...apiList.getStationTasks,
-      data
-    })
-  },
-
-  // 更新任务人工开始时间
-  updateTaskStatus (data) {
-    return axiosApi({
-      ...apiList.updateTaskStatus,
-      data
-    })
-  },
-}
+/*********************** 【任务管理】API ********************/
+import axiosApi from '../AxiosApi.js'
+
+const apiList = {
+	getList: {
+	    method: 'POST',
+	    url: `/authority/task/all`
+	  },
+  	page: {
+	    method: 'POST',
+	    url: `/authority/task/page`
+  	},
+	update: {
+	    method: 'POST',
+	    url: `/authority/task/update`
+	},
+  	save: {
+    	method: 'POST',
+    	url: `/authority/task`
+  	},
+	updateStatus: {
+	    method: 'POST',
+	    url: `/authority/task/status`
+	},
+  	remove: {
+    	method: 'DELETE',
+    	url: `/authority/task`
+  	},
+  	delete: {
+    	method: 'POST',
+    	url: `/authority/task/delete`
+  	},
+	// 任务-甘特图 (月模式)
+	scheduleTaskpageList: {
+	    method: 'POST',
+	    url: `/authority/task/scheduleTaskpageList`
+	},
+	// 任务-甘特图 (日模式)
+	scheduleTaskDaypageList: {
+	    method: 'POST',
+	    url: `/authority/task/scheduleTaskDaypageList`
+	},
+  	// 任务,头上统计数据API
+  	getTaskCount: {
+    	method: 'POST',
+    	url: `/authority/task/getTaskCount`
+  	},
+  	list: {
+    	method: 'POST',
+    	url: `/authority/task/query`
+  	},
+  	preview: {
+    	method: 'POST',
+    	url: `/authority/task/preview`
+  	},
+
+  	// 根据生产资源获取当前执行任务信息
+  	getTaskByResourceId: {
+    	method: 'POST',
+    	url: `/authority/task/getTaskByResourceId`
+  	},
+
+  	// 检测当前设备是否有正在执行的任务
+  	checkExeTask: {
+    	method: 'POST',
+    	url: `/authority/task/checkExeTask`
+  	},
+
+  	// 查询生产资源上的任务节点
+  	taskAutoNodeListByResource: {
+    	method: 'POST',
+    	url: `/authority/autoNode/taskAutoNodeListByResource`
+  	},
+
+  	export: {
+    	method: 'POST',
+    	url: `/authority/task/export`
+  	},
+  	import: {
+    	method: 'POST',
+    	url: `/authority/task/import`
+  	},
+    getStationTasks: {
+      method: 'POST',
+      url: `/authority/task/getStationTasks`
+    },
+    updateTaskStatus: {
+      method: 'POST',
+      url: `/authority/task/updateTaskStatus`
+    },
+    releaseClamp: {
+      method: 'POST',
+      url: `/authority/task/releaseClamp`
+    },
+    procesRfid: {
+      method: 'POST',
+      url: `/authority/task/procesRfid`
+    },
+
+}
+
+export default {
+	getList (data) {
+    return axiosApi({
+      ...apiList.getList,
+      data
+    })
+  },
+  page (data) {
+    return axiosApi({
+      ...apiList.page,
+      data
+    })
+  },
+  save (data) {
+    return axiosApi({
+      ...apiList.save,
+      data
+    })
+  },
+  update (data) {
+    return axiosApi({
+      ...apiList.update,
+      data
+    })
+  },
+  updateStatus (data) {
+    return axiosApi({
+      ...apiList.updateStatus,
+      data
+    })
+  },
+  remove (data) {
+    return axiosApi({
+      ...apiList.remove,
+      data
+    })
+  },
+  // 任务-甘特图
+  scheduleTaskpageList (data) {
+    return axiosApi({
+      ...apiList.scheduleTaskpageList,
+      data
+    })
+  },
+  // 任务-甘特图
+  scheduleTaskDaypageList (data) {
+    return axiosApi({
+      ...apiList.scheduleTaskDaypageList,
+      data
+    })
+  },
+  delete (data) {
+    return axiosApi({
+      ...apiList.remove,
+      data
+    })
+  },
+  getTaskCount (data) {
+    return axiosApi({
+      ...apiList.getTaskCount,
+      data
+    })
+  },
+  list (data) {
+    return axiosApi({
+      ...apiList.list,
+      data
+    })
+  },
+  check (code) {
+    return axiosApi({
+      method: 'GET',
+      url: `/authority/task/check/${code}`
+    })
+  },
+
+  	// 根据生产资源获取当前执行任务信息
+  	getTaskByResourceId (data) {
+	    return axiosApi({
+	      	...apiList.getTaskByResourceId,
+	      	data
+	    })
+  	},
+
+  	// 检测当前设备是否有正在执行的任务
+  	checkExeTask (data) {
+	    return axiosApi({
+	      	...apiList.checkExeTask,
+	      	data
+	    })
+  	},
+
+  	// 查询生产资源上的任务节点
+  	taskAutoNodeListByResource (data) {
+	    return axiosApi({
+	      	...apiList.taskAutoNodeListByResource,
+	      	data
+	    })
+  	},
+
+
+  checkField (data) {
+    return axiosApi({
+      method: 'POST',
+      url: `/authority/task/check`,
+      data
+    })
+  },
+  preview (data) {
+    return axiosApi({
+      ...apiList.preview,
+      data
+    })
+  },
+  export (data) {
+    return axiosApi({
+      ...apiList.export,
+      responseType: "blob",
+      data
+    })
+  },
+  import (data) {
+    return axiosApi({
+      ...apiList.import,
+      data
+    })
+  },
+  // 查询生产资源上的任务节点
+  getStationTasks (data) {
+    return axiosApi({
+      ...apiList.getStationTasks,
+      data
+    })
+  },
+
+  // 更新任务人工开始时间
+  updateTaskStatus (data) {
+    return axiosApi({
+      ...apiList.updateTaskStatus,
+      data
+    })
+  },
+
+  // 人工上下料拆除夹具
+  releaseClamp (data) {
+    return axiosApi({
+      ...apiList.releaseClamp,
+      data
+    })
+  },
+  // rfid内容读写
+  procesRfid (data) {
+    return axiosApi({
+      ...apiList.procesRfid,
+      data
+    })
+  },
+}

+ 4 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/Index.vue

@@ -261,6 +261,7 @@ export default {
       options: [
       ],
       currentStationId: "",
+      currentStationName: "",
       taskCount: 6,
       taskData: [
       ],
@@ -319,6 +320,7 @@ export default {
             if (res.data.length > 0) {
               this.options = res.data;
               this.currentStationId = this.options[0].id
+              this.currentStationName = this.options[0].name
               taskMgrApi.getStationTasks({ resourceId : this.currentStationId }).then((res) => {
                 res = res.data;
                 if (res.isSuccess) {
@@ -351,7 +353,8 @@ export default {
         // })
         // item.procedurePosition = current[0].name;
         // 只有开始中的页面可以点击进入详情页面操作
-        if(item.status === '2'){
+        item.currentStationName = this.currentStationName
+        if(item.status === '2' || item.status === '1'){
             if(item.taskName == '上料'){
                 this.$refs.view1.setTenant(item)
                 this.view1Visible = true

+ 39 - 3
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View1.vue

@@ -38,7 +38,7 @@
                     <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.procedurePosition}}</td>
+    				<td>{{tenant.currentStationName}}</td>
 				</tr>
     			<tr>
     				<td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
@@ -141,7 +141,7 @@ export default {
       tenant: {},
       queryParams: initQueryParams({}),
       loading: false,
-	  uniqueCode: '',
+	    uniqueCode: '',
     	tenantViewVisible: false,
     	tableKey: 0,
 	  	tableData: {
@@ -183,6 +183,11 @@ export default {
 	},
 	next(){
 	    // TODO 写入rfid内容(子盘信息和夹具信息)
+      taskMgrApi.procesRfid({ "id" : this.tenant.id, rfidType: "write" }).then((res) => {
+        res = res.data;
+        if (res.isSuccess) {
+        }
+      });
       if (this.active++ > 1) this.active = 0;
 	},
   	submitForm(){
@@ -242,11 +247,42 @@ export default {
         }
       });
 
-
     },
     close () {
       this.$emit('close')
     },
+
+    generate(){
+      this.uniqueCode = this.uuid(32,16)
+    },
+
+    uuid(len, radix) {
+      var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
+      var uuid = [], i;
+      radix = radix || chars.length;
+      if (len) {
+          // Compact form
+          for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
+      } else {
+          // rfc4122, version 4 form
+          var r;
+
+          // rfc4122 requires these characters
+          uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
+          uuid[14] = '4';
+
+          // Fill in random data.  At i==19 set the high bits of clock sequence as
+          // per rfc4122, sec. 4.1.5
+          for (i = 0; i < 36; i++) {
+              if (!uuid[i]) {
+                  r = 0 | Math.random()*16;
+                  uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
+              }
+          }
+      }
+
+      return uuid.join('').toLowerCase();
+    }
   }
 }
 </script>

+ 1 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View2.vue

@@ -33,7 +33,7 @@
                     <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.procedurePosition}}</td>
+    				<td>{{tenant.currentStationName}}</td>
 				</tr>
     			<tr>
     				<td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>

+ 30 - 2
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View3.vue

@@ -33,7 +33,7 @@
                     <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.procedurePosition}}</td>
+    				<td>{{tenant.currentStationName}}</td>
 				</tr>
     			<tr>
     				<td class="blodTd" align="center">{{$t("runCenter.form.viewSched.startTime")+":"}}</td>
@@ -141,10 +141,38 @@ export default {
   },
   methods: {
 	release(){
-
+	    // 上下料站拆除夹具
+      taskMgrApi.releaseClamp({ "id" : this.tenant.id}).then((res) => {
+          res = res.data;
+          if (res.isSuccess) {
+              // 通知列表
+              this.$emit("success");
+              // 通知列表-并关闭弹出框
+              this.$emit("close");
+          }
+      });
 	},
 	print(row){
+      // TODO 等待伟立调试
+      let code = row.uniqueCode
 
+      var socket = null
+      try{
+          socket = new WebSocket('ws://192.168.170.69:8888')
+          socket.onopen= function(){
+              console.log("连接成功!")
+              socket.send(code)
+          }
+          socket.onmessage= function(msg){console.log(msg)}
+          socket.onerror = function(e){alert("连接失败:"+e)}
+          socket.onclose= function(e){
+              console.log("连接关闭:"+ e.code)
+              socket.close()
+          }
+      }catch(ex){
+          alert('连接异常'+ex);
+          return;
+      }
 	},
   	submitForm(){
         taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end"}).then((res) => {