瀏覽代碼

打卡和报工页面处理

oyq28 2 周之前
父節點
當前提交
5ef5dfc939

+ 10 - 0
imcs-ui/src/api/machiningClient/stationMgr.js

@@ -18,6 +18,10 @@ const apiList = {
 	    method: 'POST',
 	    url: `/authority/stationUser/updateAll`
 	},
+	updateSchedule: {
+		method: 'POST',
+	    url: `/authority/scheduleUserDate/updateSchedule`
+	},
 	allStation: {
 	    method: 'GET',
 	    url: `/authority/stationUser/allStation`
@@ -138,6 +142,12 @@ export default {
 	      	data
 	    })
   	},
+	updateSchedule (data) {
+	    return axiosApi({
+	      	...apiList.updateSchedule,
+	      	data
+	    })
+  	},
 	getCutToolStation (data) {
 	    return axiosApi({
 	      	...apiList.getCutToolStation,

+ 53 - 29
imcs-ui/src/views/zuihou/machiningClient/scheduleTask/Index.vue

@@ -62,23 +62,27 @@
           </span>
           <el-row :gutter="20" v-show="hasTask">
             <el-col :span="20">
-            <div class="tag-group">       
-              <el-badge value="完成" class="bItem">     
-                <el-tag 
+            <div class="tag-group">
+              <el-badge :value="assignTask.startTime?'完成':''" class="bItem">
+              <el-tag 
                    size="medium"
                    class="input-new-tag"                   
                     effect="dark">
-                    上班
-                </el-tag>     
+                    上班{{assignTask.planStartTime? assignTask.planStartTime.substring(0,5):''}} 
+                      <span class="tagTip">{{assignTask.startTime? assignTask.startTime.substring(10)+'已打卡':''}}</span>                  
+                </el-tag>
+                
               </el-badge>
-              <el-badge value="完成" class="bItem">     
-                <el-tag 
+             
+              <el-badge :value="assignTask.endTime?'完成':''" class="bItem">     
+                 <el-tag 
                    size="medium"
                    class="input-new-tag"     
-                   type = "info"              
+                   :type = "assignTask.startTime?'':'info'"              
                     effect="dark">
-                    下班
-                </el-tag>     
+                    下班{{assignTask.planEndTime? assignTask.planEndTime.substring(0,5):''}}
+                    <span class="tagTip">{{assignTask.endTime? assignTask.endTime.substring(10)+'已打卡':''}}</span>
+                </el-tag>  
               </el-badge>              
            </div>
           </el-col> 
@@ -86,7 +90,9 @@
           <el-row :gutter="24" v-show="hasTask">              
               <el-col :span="8" :offset="8">
                 <div class="grid-content">
-                  <el-button type="success" class="large-round-button"  circle  @click="assign" >任务打卡 {{currentTime}}</el-button>                 
+                  <el-button type="success" class="large-round-button"  circle  @click="assign">
+                       {{assignTask.startTime?(assignTask.endTime?'':'下班打卡'):'上班打卡'}} {{currentTime}}
+                  </el-button>                 
                 </div>
               </el-col>              
           </el-row>  
@@ -174,6 +180,7 @@ export default {
       currentTime: '',
       currentDate: '',
       hasTask: true,
+      assignTask:{},
       options: [
       ],
       currentStationId: "",
@@ -274,6 +281,26 @@ export default {
       console.log(value);
     },
     assign(){
+      let ret = this.assignTask.startTime && this.assignTask.endTime
+      if(ret) {
+        this.$message({
+              message: "打卡已完成,请勿重复点击",
+              type: 'warning'
+            });
+            return false
+      }
+      let onWork = this.assignTask.startTime? false:true
+      stationMgrApi.updateSchedule({ id: this.assignTask.id, onWork: onWork })
+        .then((res) => {
+          res = res.data;
+          if (res.isSuccess) {
+            this.$message({
+              message: "打卡成功",
+              type: 'success'
+            });
+            this.getCurrentSchedule();         
+          }
+        }).catch(()=>{ });
 
     },
     getCurrentSchedule() {
@@ -281,22 +308,13 @@ export default {
         .then((res) => {
           res = res.data;
           if (res.isSuccess) {
-            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,type : "0" }).then((res) => {
-                res = res.data;
-                if (res.isSuccess) {
-                    // if (res.data.length > 0) {
-                        this.taskData = res.data;
-                    // }
-                }
-              }); */
-              console.log(res.data)
-            }
+            console.log(res.data)
+            this.assignTask = res.data            
           }else{
+            this.$message({
+              message: "今天没有加工任务",
+              type: 'warning'
+            });
             this.hasTask = false
             this.clearTimer()
           }
@@ -443,7 +461,7 @@ export default {
     margin-left: 20px;
   }
   .input-new-tag {
-    width: 150px;
+    width: 200px;
     margin-left: 10px;
     vertical-align: bottom;
     height: 50px;
@@ -459,8 +477,8 @@ export default {
    margin-top:100px;
 }
 .large-round-button {
-  width: 300px; /* 设置按钮的宽度 */
-  height: 300px; /* 设置按钮的高度 */
+  width: 250px; /* 设置按钮的宽度 */
+  height: 250px; /* 设置按钮的高度 */
   border-radius: 50%; /* 使按钮变成圆形 */
   background-color: #007BFF; /* 设置背景颜色 */
   color: white; /* 设置文字颜色 */
@@ -469,6 +487,12 @@ export default {
   cursor: pointer; /* 鼠标悬停时显示手指图标 */
   outline: none; /* 移除点击后的轮廓线 */
 }
+.tagTip{
+   color:#444;
+   font-size:8px;
+   margin-left:15px;
+   float:right;
+}
 
 .tabTitle {
   font-size: 24px;

+ 50 - 12
imcs-ui/src/views/zuihou/machiningClient/touchScreen/Index.vue

@@ -116,8 +116,13 @@
                     fit="fill"
                   >
                   </el-image>
-
-                  <span style="text-align: center;"><h2>{{ item.name }}_{{ item.content }}</h2></span>
+                  
+                  <div style="text-align: center;">    
+                      <el-badge :value="item.synFlag=='1'?'报工任务':''" class="item">                
+                         <h2>{{ item.name }}_{{ item.content }}</h2>
+                      </el-badge>                     
+                    </div>
+                  
                   <div class="itemNo" style="margin-top: 10px" >任务编号: {{ item.no }}</div>
                 </div>
                 <el-form style="margin-top: 10px">
@@ -300,6 +305,7 @@ import stationMgrApi from "@/api/machiningClient/stationMgr";
 import taskMgrApi from "@/api/runManageCenter/taskMgr";
 import machiningClientApi from "@/api/machiningClient/machiningClient"
 import Pagination from "@/components/Pagination"
+import moment from 'moment';
 export default {
   name: "TouchScreen",
   components: {Pagination, TaskView,TaskView1,TaskView2,TaskView3,TaskView4, TaskView5, TaskView6,TaskView7},
@@ -308,6 +314,8 @@ export default {
     return {
       tableKey: 0,
       queryParams: initQueryParams({}),
+      hasTask: true,
+      assignTask:{},
       RFIDParams: {
 		    url: "192.168.11.130",
 		    port: "102",
@@ -346,7 +354,9 @@ export default {
   },
   // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
   created() {
+    this.currentDate = moment().format('YYYY-MM-DD');
     this.getStation();
+    this.getCurrentSchedule();
   },
   watch: {
     'taskData': {
@@ -366,8 +376,7 @@ export default {
       return this.$store.state.account.user;
     },
   },
-  mounted() {
-    //setInterval(this.getStation, 2000);
+  mounted() {   
     this.timerTask()
   },
   methods: {
@@ -474,15 +483,44 @@ export default {
     resolveLogo(logo) {
       return require(`@/assets/yunMap/${logo}`);
     },
+    getCurrentSchedule() {
+      stationMgrApi.getCurrentSchedule({ userId: this.$store.state.account.user.id, date: this.currentDate })
+        .then((res) => {
+          res = res.data;
+          if (res.isSuccess) {            
+            this.assignTask = res.data            
+          }else{            
+            this.hasTask = false            
+          }
+        }).catch(()=>{ });
+    },
+    checkAssign(){
+       if(!this.hasTask){
+           this.$message({
+              message: "今天没有加工任务",
+              type: 'warning'
+            });
+          return false  
+       }
+       if(!this.assignTask.startTime){
+            this.$message({
+              message: "确认是否未打卡",
+              type: 'warning'
+            });
+            return false;
+       }
+       if(this.assignTask.endTime){
+        this.$message({
+              message: "下班打卡已经完成",
+              type: 'warning'
+            });
+            return false;
+       }
+       return true;
+    },
     view (item) {
-        // let that = this;
-        // let current = that.options.filter(function (c, i, a) {
-        //   if (c.value == that.currentStationId) {
-        //      return c
-        //   }
-        // })
-        // item.procedurePosition = current[0].name;
-        // 只有开始中的页面可以点击进入详情页面操作
+        if(item.synFlag=="1" && !this.checkAssign()) return false
+
         console.log("开始")
         item.currentStationName = this.currentStationName
         if(item.exeStatus === '2' && item.interfaceType === '04' && item.step=="1"){

+ 2 - 1
imcs-ui/src/views/zuihou/runManageCenter/orderMgr/components/outNewOrder/index.vue

@@ -488,9 +488,10 @@
 
 	      this.queryParams.current = params.current ? params.current : this.queryParams.current
 	      this.queryParams.size = params.size ? params.size : this.queryParams.size
-	      // 查询必须参数-新增外部:orderstatus  = 1 and source = 2 and auditStatus = 1
+	      // 查询必须参数-新增外部:orderstatus  = 1 and source = 2 
 	      this.queryParams.model.orderStatus = '1'
 	      this.queryParams.model.source = '2'
+		  this.queryParams.model.auditStatus = '0'
 	      orderMgrApi.page(this.queryParams).then(response => {
 	        const res = response.data
 	        if (res.isSuccess) {